| Server IP : 209.209.40.120 / Your IP : 216.73.217.112 Web Server : Microsoft-IIS/10.0 System : Windows NT NEWWWW 10.0 build 17763 (Windows Server 2019) i586 User : NEWWWW$ ( 0) PHP Version : 8.3.30 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : C:/software/Services/citygist/cordova/node_modules/compare-func/ |
Upload File : |
'use strict';
var arrayify = require('array-ify');
var dotPropGet = require('dot-prop').get;
function compareFunc(prop) {
return function(a, b) {
var ret = 0;
arrayify(prop).some(function(el) {
var x;
var y;
if (typeof el === 'function') {
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 (x === y) {
ret = 0;
return;
}
if (typeof x === 'string' && typeof y === 'string') {
ret = x.localeCompare(y);
return ret !== 0;
}
ret = x < y ? -1 : 1;
return true;
});
return ret;
};
}
module.exports = compareFunc;