{"name":"alpha-sort","version":"3.1.0","description":"Alphabetically sort an array of strings","license":"MIT","repository":{"type":"git","url":"git+https://github.com/sindresorhus/alpha-sort.git"},"author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"sindresorhus.com"},"engines":{"node":">=8"},"scripts":{"test":"xo && ava && tsd"},"keywords":["alpha","alphabet","alphabetically","sort","compare","comparator","locale","unicode","string","intl","collator"],"devDependencies":{"ava":"^1.4.1","tsd":"^0.7.2","xo":"^0.24.0"},"gitHead":"06e3eec1cd95c3288a7ac069e1020551918c3bb0","bugs":{"url":"https://github.com/sindresorhus/alpha-sort/issues"},"homepage":"https://github.com/sindresorhus/alpha-sort#readme","_id":"alpha-sort@3.1.0","_nodeVersion":"10.20.1","_npmVersion":"6.14.4","_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"dist":{"integrity":"sha512-mRMFzTqMpyGsMUN/rytVErIFQ0nNtMQdyxop09082hTVYbfK2rts7E1XpTExaEyxKT5JZimdA7zGgVQMVgOfXA==","shasum":"debba2da76434a7b42963e51b007431e404b78e6","tarball":"http://registry-npm.ywwl.com/alpha-sort/download/alpha-sort-3.1.0.tgz","fileCount":5,"unpackedSize":4726,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJes5oNCRA9TVsSAnZWagAAxTkP/1Ox895xRgeyX3mutdur\nppGSOlN0e8gP6DBWlCD9M+gRLGGt5HD4NLhxWunmyaT/dXOgDU/7127qR5EN\n9Nyg2sMUsueDFFetB9bSxkOitO68ZmQzYCVQjNUXnFVADxzPdTVvGr02elW6\nw4ygIXwM3iPBBrn6o4hntk5v77BYWmo5yiF9YXCnuHGtXFRoaDkF9QLb8Ubv\nAGkDDzwGiQCgDGwAkEbRmttn8ryhC9MqsJo8jgQfHI5oHU79IEfnImKEpCys\ntIyjdh5EsyTrmsQkASj0SXAoP57vfktmWFvwVBLdj1OzgbZNK8HuFdsQIAGK\n2SLRrY4StObLlaRRgpZGNdpzRICLEdV707QnV39ozeSqJVB8bkRwVuCxzy3s\nK2HKwgChwXxTJNpqXohe1UMqkgOEiUZ0GbUpT5dQ7swbEYQ4P4e02vYnaQVa\nB0sEP0hXLM7oaVpfhX77LdpngBKZamhV/KQjjWsYiukOfF98PLdO3E9Y0A1g\n1rV0pkseiDr1mAHqP2F5XL4xzCuUZZXoZv1Tl2IjDWnzR2oBQG1eX/Wdm/aS\nMBdaVo2YgyiynCUwwzkLw3pDbMNghW8E9adQ7gFquFE3KxxzhDLA6sKLLTu3\njaSl5AQVr5BEm9rHUa+Cr1SoXdF+Krv6KNpQaacsm5WA5fa4Qf583Ws2jvpm\noegY\r\n=DP56\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIFlZ4ISmoZYg4j/F5kJ6Hh7CGww5tT8qSAE9pvfzZ1PNAiEA+klq2d8BS2SCUhihepjlws0ZdBKPPFDNX6LS2miCY3g="}],"size":1974,"noattachment":false,"key":"/alpha-sort/-/alpha-sort-3.1.0.tgz"},"maintainers":[{"name":"sindresorhus","email":"sindresorhus@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/alpha-sort_3.1.0_1588828684723_0.5909992796921228"},"_hasShrinkwrap":false,"readme":"# alpha-sort\n\n> Alphabetically sort an array of strings\n\nWith correct sorting of unicode characters. Supports [natural sort order](https://en.wikipedia.org/wiki/Natural_sort_order) with an option.\n\n## Install\n\n```\n$ npm install alpha-sort\n```\n\n## Usage\n\n```js\nimport alphaSort from 'alpha-sort';\n\n['b', 'a', 'c'].sort(alphaSort());\n//=> ['a', 'b', 'c']\n\n['b', 'a', 'c'].sort(alphaSort({descending: true}));\n//=> ['c', 'b', 'a']\n\n['B', 'a', 'C'].sort(alphaSort({caseInsensitive: true}));\n//=> ['a', 'B', 'C']\n\n['file10.txt', 'file2.txt', 'file03.txt'].sort(alphaSort({natural: true}));\n//=> ['file2.txt', 'file03.txt', 'file10.txt']\n```\n\n## API\n\n### alphaSort(options?)\n\nGet a comparator function to be used as argument for [`Array#sort`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort).\n\n#### options\n\nType: `object`\n\n##### descending\n\nType: `boolean`\\\nDefault: `false`\n\nWhether or not to sort in descending order.\n\n##### caseInsensitive\n\nType: `boolean`\\\nDefault: `false`\n\nWhether or not to sort case-insensitively.\n\nNote: If two elements are considered equal in the case-insensitive comparison, the tie-break will be a standard (case-sensitive) comparison. Example:\n\n```js\nimport alphaSort from 'alpha-sort';\n\n['bar', 'baz', 'Baz'].sort(alphaSort({caseInsensitive: true}));\n//=> ['bar', 'Baz', 'baz']\n```\n\n##### natural\n\nType: `boolean`\\\nDefault: `false`\n\nWhether or not to sort using [natural sort order](https://en.wikipedia.org/wiki/Natural_sort_order) (such as sorting `10` after `2`).\n\nNote: If two elements are considered equal in the natural sort order comparison, the tie-break will be a standard (non-natural) comparison. Example:\n\n```js\nimport alphaSort from 'alpha-sort';\n\n['file10.txt', 'file05.txt', 'file0010.txt'].sort(alphaSort({natural: true}));\n//=> ['file05.txt', 'file0010.txt', 'file10.txt']\n```\n\n##### preprocessor\n\nType: `function`\\\nDefault: `undefined`\n\nA custom function that you can provide to manipulate the elements before sorting. This does not modify the values of the array; it only interferes in the sorting order.\n\nThis can be used, for example, if you are sorting book titles in English and want to ignore common articles such as `the`, `a` or `an`:\n\n```js\nimport alphaSort from 'alpha-sort';\n\n['The Foo', 'Bar'].sort(alphaSort({\n\tpreprocessor: title => title.replace(/^(?:the|a|an) /i, '')\n}));\n//=> ['Bar', 'The Foo']\n```\n\nNote: If two elements are considered equal when sorting with a custom preprocessor, the tie-break will be a comparison without the custom preprocessor.\n\n## Related\n\n- [num-sort](https://github.com/sindresorhus/num-sort) - Sort an array of numbers\n","publish_time":1588828684852,"_cnpm_publish_time":1588828684852,"dist-tags":{"latest":"5.0.0"}}