Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

fast-sort

Package Overview
Dependencies
Maintainers
1
Versions
53
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fast-sort - npm Package Compare versions

Comparing version 1.1.2 to 1.1.3

2

package.json

@@ -1,1 +0,1 @@

{"name":"fast-sort","version":"1.1.2","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.3","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"}}

@@ -78,19 +78,6 @@ (function webpackUniversalModuleDefinition(root, factory) {

/***/ 1:
/***/ 10:
/***/ (function(module, exports) {
// Public
module.exports = function (input) {
return Object.prototype.toString.call(input);
};
/***/ }),
/***/ 10:
/***/ (function(module, exports, __webpack_require__) {
var getTag = __webpack_require__(1);
var sorter = function sorter(direction, sortBy, subsequentSort, a, b) {
var sorter = function sorter(direction, sortBy, thenBy, depth, a, b) {
var valA = sortBy(a);

@@ -100,5 +87,4 @@ var valB = sortBy(b);

if (valA === valB) {
if (subsequentSort.length) {
var subsequent = subsequentSort.slice();
return sorter(direction, subsequent.shift(), subsequent, a, b);
if (thenBy && thenBy.length > depth) {
return sorter(direction, thenBy[depth], thenBy, depth + 1, a, b);
}

@@ -122,11 +108,2 @@ return 0;

var assertSortBy = function assertSortBy(sortBy) {
var invalidSortBy = sortBy.filter(function (s) {
return typeof s !== 'function';
});
if (invalidSortBy.length) {
throw new TypeError('sort: expected [Function] but got ' + getTag(invalidSortBy[0]));
}
};
var sort = function sort(ctx, _sorter) {

@@ -136,6 +113,5 @@ var sortBy = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : emptySortBy;

if (Array.isArray(ctx)) {
sortBy = Array.isArray(sortBy) ? sortBy : [sortBy];
assertSortBy(sortBy);
return ctx.sort(_sorter.bind(null, sortBy.shift(), sortBy));
return Array.isArray(sortBy) ? ctx.sort(_sorter.bind(undefined, sortBy.shift(), sortBy, 0)) : ctx.sort(_sorter.bind(undefined, sortBy, undefined, 0));
}
return ctx;

@@ -142,0 +118,0 @@ };

@@ -1,1 +0,1 @@

!function(t,n){"object"==typeof exports&&"object"==typeof module?module.exports=n():"function"==typeof define&&define.amd?define("js-flock",[],n):"object"==typeof exports?exports["js-flock"]=n():t["js-flock"]=n()}(this,function(){return function(t){function n(e){if(r[e])return r[e].exports;var o=r[e]={i:e,l:!1,exports:{}};return t[e].call(o.exports,o,o.exports,n),o.l=!0,o.exports}var r={};return n.m=t,n.c=r,n.d=function(t,r,e){n.o(t,r)||Object.defineProperty(t,r,{configurable:!1,enumerable:!0,get:e})},n.n=function(t){var r=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(r,"a",r),r},n.o=function(t,n){return Object.prototype.hasOwnProperty.call(t,n)},n.p="",n(n.s=10)}({1:function(t,n){t.exports=function(t){return Object.prototype.toString.call(t)}},10:function(t,n,r){var e=r(1),o=function t(n,r,e,o,u){var i=r(o),f=r(u);if(i===f){if(e.length){var c=e.slice();return t(n,c.shift(),c,o,u)}return 0}return null==i?1:null==f?-1:i<f?-n:n},u=o.bind(null,1),i=o.bind(null,-1),f=function(t){return t},c=function(t){var n=t.filter(function(t){return"function"!=typeof t});if(n.length)throw new TypeError("sort: expected [Function] but got "+e(n[0]))},l=function(t,n){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:f;return Array.isArray(t)?(r=Array.isArray(r)?r:[r],c(r),t.sort(n.bind(null,r.shift(),r))):t};t.exports=function(t){return{asc:function(n){return l(t,u,n)},desc:function(n){return l(t,i,n)}}}}})});
!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)}}}}})});

@@ -1,5 +0,2 @@

const getTag = require('./internals/getTag');
const sorter = function(direction, sortBy, subsequentSort, a, b) {
const sorter = function(direction, sortBy, thenBy, depth, a, b) {
const valA = sortBy(a);

@@ -9,5 +6,4 @@ const valB = sortBy(b);

if (valA === valB) {
if (subsequentSort.length) {
const subsequent = subsequentSort.slice();
return sorter(direction, subsequent.shift(), subsequent, a, b);
if (thenBy && thenBy.length > depth) {
return sorter(direction, thenBy[depth], thenBy, depth + 1, a, b);
}

@@ -29,15 +25,9 @@ return 0;

const assertSortBy = function(sortBy) {
const invalidSortBy = sortBy.filter((s) => typeof s !== 'function');
if (invalidSortBy.length) {
throw new TypeError(`sort: expected [Function] but got ${getTag(invalidSortBy[0])}`);
}
};
const sort = function(ctx, _sorter, sortBy = emptySortBy) {
if (Array.isArray(ctx)) {
sortBy = Array.isArray(sortBy) ? sortBy : [sortBy];
assertSortBy(sortBy);
return ctx.sort(_sorter.bind(null, sortBy.shift(), sortBy));
return Array.isArray(sortBy)
? ctx.sort(_sorter.bind(undefined, sortBy.shift(), sortBy, 0))
: ctx.sort(_sorter.bind(undefined, sortBy, undefined, 0));
}
return ctx;

@@ -44,0 +34,0 @@ };

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc