How to use the natsort.default function in natsort

To help you get started, we’ve selected a few natsort examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github derhuerst / casket / lib / fs.js View on Github external
'use strict'

const fs = require('mz/fs')
const natsort = require('natsort').default({insensitive: true})
const file = require('random-access-file')



const isDir = (dir) =>
	fs.stat(dir)
	.then((s) => s.isDirectory())

const sortFiles = (fileA, fileB) => {
	if (fileA.isDir && !fileB.isDir) return -1
	if (fileB.isDir && !fileA.isDir) return 1
	return natsort(fileA.name, fileB.name)
}

const slice = (path, bytes, offset = 0) => {
	return fs.stat(path)

natsort

Javascript natural sort algorithm with unicode support.

MIT
Latest version published 3 years ago

Package Health Score

50 / 100
Full package analysis

Popular natsort functions