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

sort-on

Package Overview
Dependencies
Maintainers
2
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sort-on - npm Package Compare versions

Comparing version 1.2.1 to 1.2.2

35

index.js
'use strict';
var dotProp = require('dot-prop');
var arrify = require('arrify');
var dotPropGet = dotProp.get;

@@ -13,29 +14,29 @@

(Array.isArray(prop) ? prop : [prop]).forEach(function (el) {
var x = a;
var y = b;
arrify(prop).some(function (el) {
var x;
var y;
if (typeof el === 'function') {
x = el(x);
y = el(y);
x = el(a);
y = el(b);
} else if (typeof el === 'string') {
x = dotPropGet(a, el);
y = dotPropGet(b, el);
} else {
x = a;
y = b;
}
if (typeof el === 'string') {
x = dotPropGet(x, el);
y = dotPropGet(y, el);
}
// lower priority for each prop
ret++;
if (x === y) {
return;
ret = 0;
return false;
}
if (typeof x === 'string' && typeof y === 'string') {
ret += x.localeCompare(y);
return;
ret = x.localeCompare(y);
return ret !== 0;
}
ret += x < y ? -1 : 1;
ret = x < y ? -1 : 1;
return true;
});

@@ -42,0 +43,0 @@

{
"name": "sort-on",
"version": "1.2.1",
"version": "1.2.2",
"description": "Sort an array on an object property",

@@ -36,2 +36,3 @@ "license": "MIT",

"dependencies": {
"arrify": "^1.0.0",
"dot-prop": "^2.0.0"

@@ -38,0 +39,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