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.2.2 to 1.2.3

2

package.json

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

{"name":"fast-sort","version":"1.2.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"],"dependencies":{"js-flock":"^2.4.6"}}
{"name":"fast-sort","version":"1.2.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"],"dependencies":{"js-flock":"^2.4.7"}}

@@ -27,5 +27,2 @@ (function (global, factory) {

var ascSorter = sorter.bind(null, 1);
var descSorter = sorter.bind(null, -1);
var emptySortBy = function emptySortBy(a) {

@@ -35,3 +32,3 @@ return a;

var sort = function sort(ctx, _sorter) {
var sort = function sort(direction, ctx) {
var sortBy = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : emptySortBy;

@@ -41,3 +38,5 @@

return Array.isArray(sortBy) ? ctx.sort(_sorter.bind(undefined, sortBy.shift(), sortBy, 0)) : ctx.sort(_sorter.bind(undefined, sortBy, undefined, 0));
var _sorter = Array.isArray(sortBy) ? sorter.bind(undefined, direction, sortBy.shift(), sortBy, 0) : sorter.bind(undefined, direction, sortBy, undefined, 0);
return ctx.sort(_sorter);
};

@@ -50,6 +49,6 @@

asc: function asc(sortBy) {
return sort(ctx, ascSorter, sortBy);
return sort(1, ctx, sortBy);
},
desc: function desc(sortBy) {
return sort(ctx, descSorter, sortBy);
return sort(-1, ctx, sortBy);
}

@@ -56,0 +55,0 @@ };

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

!function(n,r){"object"==typeof exports&&"undefined"!=typeof module?module.exports=r():"function"==typeof define&&define.amd?define(r):(n.sort=n.sort||{},n.sort.js=r())}(this,function(){"use strict";var n=function n(r,t,e,i,o,u){var d=t(o),f=t(u);return d===f?e&&e.length>i?n(r,e[i],e,i+1,o,u):0:d<f?-r:null==d?1:null==f?-1:r},r=n.bind(null,1),t=n.bind(null,-1),e=function(n){return n},i=function(n,r){var t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e;return Array.isArray(n)?Array.isArray(t)?n.sort(r.bind(void 0,t.shift(),t,0)):n.sort(r.bind(void 0,t,void 0,0)):n};return function(n){return{asc:function(t){return i(n,r,t)},desc:function(r){return i(n,t,r)}}}});
!function(n,r){"object"==typeof exports&&"undefined"!=typeof module?module.exports=r():"function"==typeof define&&define.amd?define(r):(n.sort=n.sort||{},n.sort.js=r())}(this,function(){"use strict";var n=function n(r,t,e,i,o,u){var f=t(o),d=t(u);return f===d?e&&e.length>i?n(r,e[i],e,i+1,o,u):0:f<d?-r:null==f?1:null==d?-1:r},r=function(n){return n},t=function(t,e){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:r;if(!Array.isArray(e))return e;var o=Array.isArray(i)?n.bind(void 0,t,i.shift(),i,0):n.bind(void 0,t,i,void 0,0);return e.sort(o)};return function(n){return{asc:function(r){return t(1,n,r)},desc:function(r){return t(-1,n,r)}}}});

@@ -21,13 +21,12 @@ // Internals

const ascSorter = sorter.bind(null, 1);
const descSorter = sorter.bind(null, -1);
const emptySortBy = (a) => a;
const sort = function(ctx, _sorter, sortBy = emptySortBy) {
const sort = function(direction, ctx, sortBy = emptySortBy) {
if (!Array.isArray(ctx)) return ctx;
return Array.isArray(sortBy)
? ctx.sort(_sorter.bind(undefined, sortBy.shift(), sortBy, 0))
: ctx.sort(_sorter.bind(undefined, sortBy, undefined, 0));
const _sorter = Array.isArray(sortBy)
? sorter.bind(undefined, direction, sortBy.shift(), sortBy, 0)
: sorter.bind(undefined, direction, sortBy, undefined, 0);
return ctx.sort(_sorter);
};

@@ -39,5 +38,5 @@

return {
asc: (sortBy) => sort(ctx, ascSorter, sortBy),
desc: (sortBy) => sort(ctx, descSorter, sortBy)
asc: (sortBy) => sort(1, ctx, sortBy),
desc: (sortBy) => sort(-1, ctx, sortBy)
};
};
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