Comparing version 1.1.7 to 1.1.9
@@ -1,1 +0,1 @@ | ||
{"name":"fast-sort","version":"1.1.7","description":"Blazing fast array sorting.","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"],"devDependencies":{"eslint":"^4.4.1","eslint-config-airbnb-base":"^11.3.1","eslint-plugin-import":"^2.7.0","fs-extra":"^4.0.1"}} | ||
{"name":"fast-sort","version":"1.1.9","description":"Blazing fast array sorting.","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,3 +15,5 @@ # fast-sort | ||
fast-sort is part of [js-flock](https://www.npmjs.com/package/js-flock) library exported as single module. check [js-flock](https://www.npmjs.com/package/js-flock) for more cool modules. | ||
### Capabilities | ||
@@ -56,10 +58,11 @@ | ||
import sort from 'fast-sort/sort.es5.min'; // Loads transpiled minified es5 code | ||
``` | ||
fast-sort is part of js-flock library and can be included throught js-flock. | ||
// We can import same module through js-flock library | ||
```javascript | ||
// npm install js-flock --save | ||
import sort from 'js-flock/sort'; // === import sort from 'fast-sort'; | ||
import sort from 'js-flock/es5/sort'; // === import sort from 'fast-sort/sort.es5'; | ||
import sort from 'js-flock/es5/sort.min'; // === import sort from 'fast-sort/sort.es5.min'; | ||
import sort from 'js-flock/sort'; | ||
import sort from 'js-flock/es5/sort'; | ||
import sort from 'js-flock/es5/sort.min'; | ||
``` | ||
@@ -85,3 +88,5 @@ | ||
fast-sort benchmark result are represent with flock name and is colored in blue. | ||
![benchmark results](https://github.com/snovakovic/fast-sort/raw/master/benchmark.png) | ||
@@ -88,0 +93,0 @@ |
@@ -92,5 +92,5 @@ (function webpackUniversalModuleDefinition(root, factory) { | ||
if (valA < valB) return -direction; | ||
if (valA == null) return 1; | ||
if (valB == null) return -1; | ||
if (valA < valB) return -direction; | ||
@@ -110,7 +110,7 @@ return direction; | ||
if (Array.isArray(ctx)) { | ||
return Array.isArray(sortBy) ? ctx.sort(_sorter.bind(undefined, sortBy.shift(), sortBy, 0)) : ctx.sort(_sorter.bind(undefined, sortBy, undefined, 0)); | ||
if (!Array.isArray(ctx)) { | ||
return ctx; | ||
} | ||
return ctx; | ||
return Array.isArray(sortBy) ? ctx.sort(_sorter.bind(undefined, sortBy.shift(), sortBy, 0)) : ctx.sort(_sorter.bind(undefined, sortBy, undefined, 0)); | ||
}; | ||
@@ -117,0 +117,0 @@ |
@@ -1,1 +0,1 @@ | ||
!function(n,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("js-flock",[],t):"object"==typeof exports?exports["js-flock"]=t():n["js-flock"]=t()}(this,function(){return function(n){function t(e){if(r[e])return r[e].exports;var o=r[e]={i:e,l:!1,exports:{}};return n[e].call(o.exports,o,o.exports,t),o.l=!0,o.exports}var r={};return t.m=n,t.c=r,t.d=function(n,r,e){t.o(n,r)||Object.defineProperty(n,r,{configurable:!1,enumerable:!0,get:e})},t.n=function(n){var r=n&&n.__esModule?function(){return n.default}:function(){return n};return t.d(r,"a",r),r},t.o=function(n,t){return Object.prototype.hasOwnProperty.call(n,t)},t.p="",t(t.s=10)}({10:function(n,t){var r=function n(t,r,e,o,u,i){var f=r(u),c=r(i);return f===c?e&&e.length>o?n(t,e[o],e,o+1,u,i):0:null==f?1:null==c?-1:f<c?-t:t},e=r.bind(null,1),o=r.bind(null,-1),u=function(n){return n},i=function(n,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:u;return Array.isArray(n)?Array.isArray(r)?n.sort(t.bind(void 0,r.shift(),r,0)):n.sort(t.bind(void 0,r,void 0,0)):n};n.exports=function(n){return{asc:function(t){return i(n,e,t)},desc:function(t){return i(n,o,t)}}}}})}); | ||
!function(n,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("js-flock",[],t):"object"==typeof exports?exports["js-flock"]=t():n["js-flock"]=t()}(this,function(){return function(n){function t(e){if(r[e])return r[e].exports;var o=r[e]={i:e,l:!1,exports:{}};return n[e].call(o.exports,o,o.exports,t),o.l=!0,o.exports}var r={};return t.m=n,t.c=r,t.d=function(n,r,e){t.o(n,r)||Object.defineProperty(n,r,{configurable:!1,enumerable:!0,get:e})},t.n=function(n){var r=n&&n.__esModule?function(){return n.default}:function(){return n};return t.d(r,"a",r),r},t.o=function(n,t){return Object.prototype.hasOwnProperty.call(n,t)},t.p="",t(t.s=10)}({10:function(n,t){var r=function n(t,r,e,o,u,i){var f=r(u),c=r(i);return f===c?e&&e.length>o?n(t,e[o],e,o+1,u,i):0:f<c?-t:null==f?1:null==c?-1:t},e=r.bind(null,1),o=r.bind(null,-1),u=function(n){return n},i=function(n,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:u;return Array.isArray(n)?Array.isArray(r)?n.sort(t.bind(void 0,r.shift(),r,0)):n.sort(t.bind(void 0,r,void 0,0)):n};n.exports=function(n){return{asc:function(t){return i(n,e,t)},desc:function(t){return i(n,o,t)}}}}})}); |
12
sort.js
@@ -12,5 +12,5 @@ const sorter = function(direction, sortBy, thenBy, depth, a, b) { | ||
if (valA < valB) return -direction; | ||
if (valA == null) return 1; | ||
if (valB == null) return -1; | ||
if (valA < valB) return -direction; | ||
@@ -26,9 +26,9 @@ return direction; | ||
const sort = function(ctx, _sorter, sortBy = emptySortBy) { | ||
if (Array.isArray(ctx)) { | ||
return Array.isArray(sortBy) | ||
? ctx.sort(_sorter.bind(undefined, sortBy.shift(), sortBy, 0)) | ||
: ctx.sort(_sorter.bind(undefined, sortBy, undefined, 0)); | ||
if (!Array.isArray(ctx)) { | ||
return ctx; | ||
} | ||
return ctx; | ||
return Array.isArray(sortBy) | ||
? ctx.sort(_sorter.bind(undefined, sortBy.shift(), sortBy, 0)) | ||
: ctx.sort(_sorter.bind(undefined, sortBy, undefined, 0)); | ||
}; | ||
@@ -35,0 +35,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
12005
0
103