make-sort-key
v1.0.4
Published
Combine several strings to make one sort key
Downloads
4
Readme
make-sort-key
Combine several strings to make one sort key.
The following transformations occur:
- inputs are lowercased,
- accents are removed,
- redundant spaces are removed,
- null, undefined or empty inputs are ignored,
- finally, resulting strings are concatenated with a space separator.
Installation
npm install --save make-sort-key
Examples
import makeSortKey from 'make-sort-key';
console.log(makeSortKey('Dûpont', 'Jêàn')); // => dupont jean
console.log(makeSortKey(' Apple Computer ')); // => apple computer
console.log(makeSortKey('', undefined, 'Apple Computer')); // => apple computer
License
MIT