Comparing version 1.5.3 to 1.5.4
@@ -1,1 +0,1 @@ | ||
{"name":"fast-sort","version":"1.5.3","description":"Fast and powerful array sorting. Sort by any property in any direction with easy to read syntax.","main":"sort.js","author":"Stefan Novakovic <stefan.novakovich@gmail.com>","license":"MIT","homepage":"https://github.com/snovakovic/fast-sort#readme","scripts":{"test":"node integration_test/index.js","publish":"node publish"},"repository":{"type":"git","url":"git+https://github.com/snovakovic/js-flock.git"},"bugs":{"url":"https://github.com/snovakovic/js-flock/issues"},"keywords":["sort","sortBy","order","orderBy"]} | ||
{"name":"fast-sort","version":"1.5.4","description":"Fast and powerful array sorting. Sort by any property in any direction with easy to read syntax.","main":"sort.js","author":"Stefan Novakovic <stefan.novakovich@gmail.com>","license":"MIT","homepage":"https://github.com/snovakovic/fast-sort#readme","scripts":{"test":"node integration_test/index.js","publish":"node publish"},"repository":{"type":"git","url":"git+https://github.com/snovakovic/js-flock.git"},"bugs":{"url":"https://github.com/snovakovic/js-flock/issues"},"keywords":["sort","sortBy","order","orderBy"]} |
@@ -15,11 +15,4 @@ # fast-sort | ||
fast-sort is part of [js-flock](https://www.npmjs.com/package/js-flock) library exported as single module. Please reference [js-flock](https://github.com/snovakovic/js-flock) github repository for source code, issue opening, contributing or giving a star ;) | ||
### Fast sort highlights | ||
Under the hood sort use a [native JavaScript sort](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort). | ||
Usage of native sort implies that sorting is not necessarily [stable](https://en.wikipedia.org/wiki/Sorting_algorithm#Stability) and it also implies that input array is modified(sorted) same as it would be when applying native sort. | ||
### Fast sort higlights | ||
* Sorting an array of objects by one or more properties | ||
@@ -32,2 +25,4 @@ * Sorting flat arrays | ||
Under the hood sort use a [native JavaScript sort](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort). | ||
Usage of native sort implies that sorting is not necessarily [stable](https://en.wikipedia.org/wiki/Sorting_algorithm#Stability) and it also implies that input array is modified(sorted) same as it would be when applying native sort | ||
@@ -39,10 +34,10 @@ ### Example | ||
sort([1,4,2]).asc(); // sort array in ascending order [1, 2, 4] | ||
sort([1,4,2]).desc(); // sort array in descending order [4, 2, 1] | ||
sort([1,4,2]).asc(); // => [1, 2, 4] | ||
sort([1,4,2]).desc(); // => [4, 2, 1] | ||
// Sort persons [Object] ascending by firstName | ||
// Sort users [Object] ascending by firstName | ||
sort(users).asc(u => u.firstName); | ||
// Same as above (but bit more performant) | ||
// NOTE: sorting by string is avaliable from version [1.3.0] | ||
// If sorting by single property we can use string syntax | ||
// NOTE: sorting by string is available from version [1.3.0] | ||
sort(users).asc('firstName'); | ||
@@ -53,7 +48,7 @@ | ||
// Sort users by multiple properties | ||
// Sort users by firstName, lastName and city | ||
sort(users).desc([ | ||
'firstName', // Sort by first name | ||
'lastName', // Persons that have same firstName will be sorted by lastName | ||
u => u.address.city // NOTE: For nested properties we have to use function as 'address.city' is not valid property | ||
'firstName', | ||
'lastName', | ||
u => u.address.city // String syntax is not available for nested properties | ||
]); | ||
@@ -66,3 +61,2 @@ | ||
{ desc: 'age' } | ||
{ asc: p => p.address.city } | ||
]); | ||
@@ -78,2 +72,5 @@ | ||
NOTE: fast-sort is part of [js-flock](https://www.npmjs.com/package/js-flock) library exported as single module. | ||
### Benchmark | ||
@@ -80,0 +77,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
18543
102