JSPM

  • Created
  • Published
  • Downloads 234
  • Score
    100M100P100Q84087F
  • License MIT

Install PureScript to the given directory

Package Exports

  • install-purescript

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (install-purescript) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

readdir-sorted

NPM version Build Status Build status Coverage Status

Like fs.readdir but sorts the result based on String#localeCompare()

const readdirSorted = require('readdir-sorted');

readdirSorted('.').then(paths => {
  paths; /* => [
    '.editorconfig',
    '.gitattributes',
    '.gitignore',
    '.travis.yml',
    'index.js',
    'LICENSE',
    'package.json',
    'README.md',
    'test'
  ] */
});

Installation

Use npm.

npm install readdir-sorted

API

const readdirSorted = require('readdir-sorted');

readdirSorted(path [, options])

path: String (directory path)
options: Object
Return: Promise<Array>

Similar to Node.js built-in fs.readdir, but different in the following points:

  • Returns a Promise
  • Doesn't support encoding option
  • The result is sorted based on String#localeCompare()

Options

locale property will be passed to the second argument of String#localeCompare(), and the rest will be used in the third argument.

readdirSorted('/path/to/dir').then(paths => {
  paths; /* => ['10', '2', 'ä', 'z'] */
});

readdirSorted('/path/to/dir', {
  locale: 'sv',
  numeric: true
}).then(paths => {
  paths; /* => ['2', '10', 'z', 'ä'] */
});

License

Copyright (c) 2017 Shinnosuke Watanabe

Licensed under the MIT License.