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

natural-orderby

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

natural-orderby - npm Package Compare versions

Comparing version 1.1.1 to 2.0.0

73

cjs/natural-orderby.js

@@ -184,3 +184,3 @@ 'use strict';

var stringify = function stringify(value, caseSensitive) {
var stringify = function stringify(value) {
if (typeof value === 'boolean' || value instanceof Boolean) {

@@ -199,3 +199,3 @@ return Number(value).toString();

if (typeof value === 'string' || value instanceof String) {
return (caseSensitive ? value : value.toLowerCase()).replace(RE_LEADING_OR_TRAILING_WHITESPACES, '');
return value.toLowerCase().replace(RE_LEADING_OR_TRAILING_WHITESPACES, '');
}

@@ -297,29 +297,23 @@

var getMappedValueRecord = function getMappedValueRecord(caseSensitive) {
if (caseSensitive === void 0) {
caseSensitive = true;
}
return function (value) {
if (typeof value === 'string' || value instanceof String || (typeof value === 'number' || value instanceof Number) && !isNaN(value) || typeof value === 'boolean' || value instanceof Boolean || value instanceof Date) {
var stringValue = stringify(value, caseSensitive);
var parsedNumber = numberify(stringValue);
var chunks = createChunksList(parsedNumber ? "" + parsedNumber : stringValue);
return {
parsedNumber: parsedNumber,
chunks: chunks,
value: value
};
}
var getMappedValueRecord = function getMappedValueRecord(value) {
if (typeof value === 'string' || value instanceof String || (typeof value === 'number' || value instanceof Number) && !isNaN(value) || typeof value === 'boolean' || value instanceof Boolean || value instanceof Date) {
var stringValue = stringify(value);
var parsedNumber = numberify(stringValue);
var chunks = createChunksList(parsedNumber ? "" + parsedNumber : stringValue);
return {
isArray: Array.isArray(value),
isFunction: isFunction(value),
isNaN: isNaN(value),
isNull: isNull(value),
isObject: isObject(value),
isSymbol: isSymbol(value),
isUndefined: isUndefined(value),
parsedNumber: parsedNumber,
chunks: chunks,
value: value
};
}
return {
isArray: Array.isArray(value),
isFunction: isFunction(value),
isNaN: isNaN(value),
isNull: isNull(value),
isObject: isObject(value),
isSymbol: isSymbol(value),
isUndefined: isUndefined(value),
value: value
};

@@ -344,3 +338,3 @@ };

return getValueByIdentifier(element, identifier);
}).map(getMappedValueRecord());
}).map(getMappedValueRecord);
return {

@@ -500,5 +494,4 @@ index: index,

return function (valueA, valueB) {
var getMappedValueRecord$$1 = getMappedValueRecord(options.caseSensitive);
var a = getMappedValueRecord$$1(valueA);
var b = getMappedValueRecord$$1(valueB);
var a = getMappedValueRecord(valueA);
var b = getMappedValueRecord(valueB);
var result = compareValues(a, b);

@@ -509,15 +502,17 @@ return result * (options.order === 'desc' ? -1 : 1);

var defaultOptions = {
caseSensitive: true,
order: 'asc'
var isValidOrder = function isValidOrder(value) {
return typeof value === 'string' && (value === 'asc' || value === 'desc');
};
var getOptions = function getOptions(customOptions) {
if (!customOptions || typeof customOptions !== 'object') {
return defaultOptions;
var order = 'asc';
if (typeof customOptions === 'string' && isValidOrder(customOptions)) {
order = customOptions;
} else if (customOptions && typeof customOptions === 'object' && customOptions.order && isValidOrder(customOptions.order)) {
order = customOptions.order;
}
return {
caseSensitive: typeof customOptions.caseSensitive === 'boolean' ? customOptions.caseSensitive : defaultOptions.caseSensitive,
order: customOptions.order === 'asc' || customOptions.order === 'desc' ? customOptions.order : defaultOptions.order
order: order
};

@@ -530,6 +525,2 @@ };

*
* If `options` or its property `caseSensitive` is unspecified, values are
* sorted case sensitive. Otherwise, specify `true` for case sensitive or
* `false` for case insensitive sorting.
*
* If `options` or its property `order` is unspecified, values are sorted in

@@ -536,0 +527,0 @@ * ascending sort order. Otherwise, specify an order of `'desc'` for descending

@@ -180,3 +180,3 @@ var compareNumbers = function compareNumbers(numberA, numberB) {

var stringify = function stringify(value, caseSensitive) {
var stringify = function stringify(value) {
if (typeof value === 'boolean' || value instanceof Boolean) {

@@ -195,3 +195,3 @@ return Number(value).toString();

if (typeof value === 'string' || value instanceof String) {
return (caseSensitive ? value : value.toLowerCase()).replace(RE_LEADING_OR_TRAILING_WHITESPACES, '');
return value.toLowerCase().replace(RE_LEADING_OR_TRAILING_WHITESPACES, '');
}

@@ -293,29 +293,23 @@

var getMappedValueRecord = function getMappedValueRecord(caseSensitive) {
if (caseSensitive === void 0) {
caseSensitive = true;
}
return function (value) {
if (typeof value === 'string' || value instanceof String || (typeof value === 'number' || value instanceof Number) && !isNaN(value) || typeof value === 'boolean' || value instanceof Boolean || value instanceof Date) {
var stringValue = stringify(value, caseSensitive);
var parsedNumber = numberify(stringValue);
var chunks = createChunksList(parsedNumber ? "" + parsedNumber : stringValue);
return {
parsedNumber: parsedNumber,
chunks: chunks,
value: value
};
}
var getMappedValueRecord = function getMappedValueRecord(value) {
if (typeof value === 'string' || value instanceof String || (typeof value === 'number' || value instanceof Number) && !isNaN(value) || typeof value === 'boolean' || value instanceof Boolean || value instanceof Date) {
var stringValue = stringify(value);
var parsedNumber = numberify(stringValue);
var chunks = createChunksList(parsedNumber ? "" + parsedNumber : stringValue);
return {
isArray: Array.isArray(value),
isFunction: isFunction(value),
isNaN: isNaN(value),
isNull: isNull(value),
isObject: isObject(value),
isSymbol: isSymbol(value),
isUndefined: isUndefined(value),
parsedNumber: parsedNumber,
chunks: chunks,
value: value
};
}
return {
isArray: Array.isArray(value),
isFunction: isFunction(value),
isNaN: isNaN(value),
isNull: isNull(value),
isObject: isObject(value),
isSymbol: isSymbol(value),
isUndefined: isUndefined(value),
value: value
};

@@ -340,3 +334,3 @@ };

return getValueByIdentifier(element, identifier);
}).map(getMappedValueRecord());
}).map(getMappedValueRecord);
return {

@@ -496,5 +490,4 @@ index: index,

return function (valueA, valueB) {
var getMappedValueRecord$$1 = getMappedValueRecord(options.caseSensitive);
var a = getMappedValueRecord$$1(valueA);
var b = getMappedValueRecord$$1(valueB);
var a = getMappedValueRecord(valueA);
var b = getMappedValueRecord(valueB);
var result = compareValues(a, b);

@@ -505,15 +498,17 @@ return result * (options.order === 'desc' ? -1 : 1);

var defaultOptions = {
caseSensitive: true,
order: 'asc'
var isValidOrder = function isValidOrder(value) {
return typeof value === 'string' && (value === 'asc' || value === 'desc');
};
var getOptions = function getOptions(customOptions) {
if (!customOptions || typeof customOptions !== 'object') {
return defaultOptions;
var order = 'asc';
if (typeof customOptions === 'string' && isValidOrder(customOptions)) {
order = customOptions;
} else if (customOptions && typeof customOptions === 'object' && customOptions.order && isValidOrder(customOptions.order)) {
order = customOptions.order;
}
return {
caseSensitive: typeof customOptions.caseSensitive === 'boolean' ? customOptions.caseSensitive : defaultOptions.caseSensitive,
order: customOptions.order === 'asc' || customOptions.order === 'desc' ? customOptions.order : defaultOptions.order
order: order
};

@@ -526,6 +521,2 @@ };

*
* If `options` or its property `caseSensitive` is unspecified, values are
* sorted case sensitive. Otherwise, specify `true` for case sensitive or
* `false` for case insensitive sorting.
*
* If `options` or its property `order` is unspecified, values are sorted in

@@ -532,0 +523,0 @@ * ascending sort order. Otherwise, specify an order of `'desc'` for descending

@@ -183,3 +183,3 @@ var naturalOrderBy = (function (exports) {

var stringify = function stringify(value, caseSensitive) {
var stringify = function stringify(value) {
if (typeof value === 'boolean' || value instanceof Boolean) {

@@ -198,3 +198,3 @@ return Number(value).toString();

if (typeof value === 'string' || value instanceof String) {
return (caseSensitive ? value : value.toLowerCase()).replace(RE_LEADING_OR_TRAILING_WHITESPACES, '');
return value.toLowerCase().replace(RE_LEADING_OR_TRAILING_WHITESPACES, '');
}

@@ -296,29 +296,23 @@

var getMappedValueRecord = function getMappedValueRecord(caseSensitive) {
if (caseSensitive === void 0) {
caseSensitive = true;
}
return function (value) {
if (typeof value === 'string' || value instanceof String || (typeof value === 'number' || value instanceof Number) && !isNaN(value) || typeof value === 'boolean' || value instanceof Boolean || value instanceof Date) {
var stringValue = stringify(value, caseSensitive);
var parsedNumber = numberify(stringValue);
var chunks = createChunksList(parsedNumber ? "" + parsedNumber : stringValue);
return {
parsedNumber: parsedNumber,
chunks: chunks,
value: value
};
}
var getMappedValueRecord = function getMappedValueRecord(value) {
if (typeof value === 'string' || value instanceof String || (typeof value === 'number' || value instanceof Number) && !isNaN(value) || typeof value === 'boolean' || value instanceof Boolean || value instanceof Date) {
var stringValue = stringify(value);
var parsedNumber = numberify(stringValue);
var chunks = createChunksList(parsedNumber ? "" + parsedNumber : stringValue);
return {
isArray: Array.isArray(value),
isFunction: isFunction(value),
isNaN: isNaN(value),
isNull: isNull(value),
isObject: isObject(value),
isSymbol: isSymbol(value),
isUndefined: isUndefined(value),
parsedNumber: parsedNumber,
chunks: chunks,
value: value
};
}
return {
isArray: Array.isArray(value),
isFunction: isFunction(value),
isNaN: isNaN(value),
isNull: isNull(value),
isObject: isObject(value),
isSymbol: isSymbol(value),
isUndefined: isUndefined(value),
value: value
};

@@ -343,3 +337,3 @@ };

return getValueByIdentifier(element, identifier);
}).map(getMappedValueRecord());
}).map(getMappedValueRecord);
return {

@@ -499,5 +493,4 @@ index: index,

return function (valueA, valueB) {
var getMappedValueRecord$$1 = getMappedValueRecord(options.caseSensitive);
var a = getMappedValueRecord$$1(valueA);
var b = getMappedValueRecord$$1(valueB);
var a = getMappedValueRecord(valueA);
var b = getMappedValueRecord(valueB);
var result = compareValues(a, b);

@@ -508,15 +501,17 @@ return result * (options.order === 'desc' ? -1 : 1);

var defaultOptions = {
caseSensitive: true,
order: 'asc'
var isValidOrder = function isValidOrder(value) {
return typeof value === 'string' && (value === 'asc' || value === 'desc');
};
var getOptions = function getOptions(customOptions) {
if (!customOptions || typeof customOptions !== 'object') {
return defaultOptions;
var order = 'asc';
if (typeof customOptions === 'string' && isValidOrder(customOptions)) {
order = customOptions;
} else if (customOptions && typeof customOptions === 'object' && customOptions.order && isValidOrder(customOptions.order)) {
order = customOptions.order;
}
return {
caseSensitive: typeof customOptions.caseSensitive === 'boolean' ? customOptions.caseSensitive : defaultOptions.caseSensitive,
order: customOptions.order === 'asc' || customOptions.order === 'desc' ? customOptions.order : defaultOptions.order
order: order
};

@@ -529,6 +524,2 @@ };

*
* If `options` or its property `caseSensitive` is unspecified, values are
* sorted case sensitive. Otherwise, specify `true` for case sensitive or
* `false` for case insensitive sorting.
*
* If `options` or its property `order` is unspecified, values are sorted in

@@ -535,0 +526,0 @@ * ascending sort order. Otherwise, specify an order of `'desc'` for descending

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

var naturalOrderBy=function(e){"use strict";var y=function(e,r){return e<r?-1:r<e?1:0},n=/(^0x[\da-fA-F]+$|^([+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?(?!\.\d+)(?=\D|\s|$))|\d+)/g,l=/^\s+|\s+$/g,t=/\s+/g,i=/^[+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?$/,u=/(^([\w ]+,?[\w ]+)?[\w ]+,?[\w ]+\d+:\d+(:\d+)?[\w ]?|^\d{1,4}[/-]\d{1,4}[/-]\d{1,4}|^\w+, \w+ \d+, \d{4})/,o=/^0+[1-9]{1}[0-9]*$/,d=/[^\x00-\x80]/,a=/[A-Za-z_]/,p=function(e,r){return e.value===r.value?0:void 0!==e.parsedNumber&&void 0!==r.parsedNumber?y(e.parsedNumber,r.parsedNumber):e.chunks&&r.chunks?function(e,r){for(var n,t,i,u,o=e.length,a=r.length,s=Math.min(o,a),c=0;c<s;c++){var f=e[c],l=r[c];if(f!==l)return""===f!=(""===l)?""===f?-1:1:"number"==typeof f&&"number"==typeof l?y(f,l):"number"==typeof f||"number"==typeof l?"number"==typeof f?-1:1:d.test(f+l)&&f.localeCompare?(i=l,(u=f.localeCompare(i))?u/Math.abs(u):0):(n=f)<(t=l)?-1:t<n?1:0}return s<o||s<a?o<=s?-1:1:0}(e.chunks,r.chunks):(t=r,((n=e).chunks?!t.chunks:t.chunks)?n.chunks?-1:1:(n.isNaN?!t.isNaN:t.isNaN)?n.isNaN?-1:1:(n.isSymbol?!t.isSymbol:t.isSymbol)?n.isSymbol?-1:1:(n.isObject?!t.isObject:t.isObject)?n.isObject?-1:1:(n.isArray?!t.isArray:t.isArray)?n.isArray?-1:1:(n.isFunction?!t.isFunction:t.isFunction)?n.isFunction?-1:1:(n.isNull?!t.isNull:t.isNull)?n.isNull?-1:1:0);var n,t},s=function(n){return"function"==typeof n?n:function(e){if(Array.isArray(e)){var r=Number(n);if(Number.isInteger(r))return e[r]}else if(e&&"object"==typeof e&&"function"!=typeof n)return e[n];return e}},c=function(e){if(0!==e.length){var r=Number(e);if(!Number.isNaN(r))return r}},v=function(e){var r=c(e);return void 0!==r?r:function(e){if(u.test(e)){var r=Date.parse(e);if(!Number.isNaN(r))return r}}(e)},f=function(e,r,n){if(i.test(e)){if(!o.test(e))return c(e)||0;if(0===r&&1<n.length&&!d.test(n[1].toString())&&!a.test(n[1].toString()))return c(e)||0;if(0<r&&"."!==n[r-1])return c(e)||0}return e.replace(t," ").replace(l,"")},m=function(e){var r;return(r=e,r.replace(n,"\0$1\0").replace(/\0$/,"").replace(/^\0/,"").split("\0")).map(f)},b=function(e){return Number.isNaN(e)||e instanceof Number&&Number.isNaN(e.valueOf())},N=function(f){return void 0===f&&(f=!0),function(e){if("string"==typeof e||e instanceof String||("number"==typeof e||e instanceof Number)&&!b(e)||"boolean"==typeof e||e instanceof Boolean||e instanceof Date){var r=(i=f,"boolean"==typeof(t=e)||t instanceof Boolean?Number(t).toString():"number"==typeof t||t instanceof Number?t.toString():t instanceof Date?t.getTime().toString():"string"==typeof t||t instanceof String?(i?t:t.toLowerCase()).replace(l,""):""),n=v(r);return{parsedNumber:n,chunks:m(n?""+n:r),value:e}}var t,i,u,o,a,s,c;return{isArray:Array.isArray(e),isFunction:(c=e,"function"==typeof c),isNaN:b(e),isNull:(s=e,null===s),isObject:(a=e,!(null===a||"object"!=typeof a||Array.isArray(a)||a instanceof Number||a instanceof String||a instanceof Boolean||a instanceof Date)),isSymbol:(o=e,"symbol"==typeof o),isUndefined:(u=e,void 0===u),value:e}}},g=function(t,e,n){var i=e.length?e.map(s):[function(e){return e}],r=t.map(function(r,e){return{index:e,values:i.map(function(e){return e(r)}).map(N())}});return r.sort(function(e,r){return function(e,r,n){for(var t=e.index,i=e.values,u=r.index,o=r.values,a=i.length,s=n.length,c=0;c<a;c++){var f=c<s?n[c]:null;if(f&&"function"==typeof f){var l=f(i[c].value,o[c].value);if(l)return l}else{var y=p(i[c],o[c]);if(y)return y*("desc"===f?-1:1)}}return t-u}(e,r,n)}),r.map(function(e){return r=t,n=e.index,r[n];var r,n})};var A={caseSensitive:!0,order:"asc"};return e.orderBy=function(e,r,n){if(!e||!Array.isArray(e))return[];var t=function(e){if(!e)return[];var r=Array.isArray(e)?[].concat(e):[e];return r.some(function(e){return"string"!=typeof e&&"number"!=typeof e&&"function"!=typeof e})?[]:r}(r),i=function(e){if(!e)return[];var r=Array.isArray(e)?[].concat(e):[e];return r.some(function(e){return"asc"!==e&&"desc"!==e&&"function"!=typeof e})?[]:r}(n);return g(e,t,i)},e.compare=function(e){var r,u,n=(r=e)&&"object"==typeof r?{caseSensitive:"boolean"==typeof r.caseSensitive?r.caseSensitive:A.caseSensitive,order:"asc"===r.order||"desc"===r.order?r.order:A.order}:A;return u=n,function(e,r){var n=N(u.caseSensitive),t=n(e),i=n(r);return p(t,i)*("desc"===u.order?-1:1)}},e}({});
var naturalOrderBy=function(r){"use strict";var y=function(r,n){return r<n?-1:n<r?1:0},e=/(^0x[\da-fA-F]+$|^([+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?(?!\.\d+)(?=\D|\s|$))|\d+)/g,f=/^\s+|\s+$/g,t=/\s+/g,i=/^[+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?$/,u=/(^([\w ]+,?[\w ]+)?[\w ]+,?[\w ]+\d+:\d+(:\d+)?[\w ]?|^\d{1,4}[/-]\d{1,4}[/-]\d{1,4}|^\w+, \w+ \d+, \d{4})/,o=/^0+[1-9]{1}[0-9]*$/,p=/[^\x00-\x80]/,a=/[A-Za-z_]/,d=function(r,n){return r.value===n.value?0:void 0!==r.parsedNumber&&void 0!==n.parsedNumber?y(r.parsedNumber,n.parsedNumber):r.chunks&&n.chunks?function(r,n){for(var e,t,i,u,o=r.length,a=n.length,s=Math.min(o,a),f=0;f<s;f++){var c=r[f],l=n[f];if(c!==l)return""===c!=(""===l)?""===c?-1:1:"number"==typeof c&&"number"==typeof l?y(c,l):"number"==typeof c||"number"==typeof l?"number"==typeof c?-1:1:p.test(c+l)&&c.localeCompare?(i=l,(u=c.localeCompare(i))?u/Math.abs(u):0):(e=c)<(t=l)?-1:t<e?1:0}return s<o||s<a?o<=s?-1:1:0}(r.chunks,n.chunks):(t=n,((e=r).chunks?!t.chunks:t.chunks)?e.chunks?-1:1:(e.isNaN?!t.isNaN:t.isNaN)?e.isNaN?-1:1:(e.isSymbol?!t.isSymbol:t.isSymbol)?e.isSymbol?-1:1:(e.isObject?!t.isObject:t.isObject)?e.isObject?-1:1:(e.isArray?!t.isArray:t.isArray)?e.isArray?-1:1:(e.isFunction?!t.isFunction:t.isFunction)?e.isFunction?-1:1:(e.isNull?!t.isNull:t.isNull)?e.isNull?-1:1:0);var e,t},s=function(e){return"function"==typeof e?e:function(r){if(Array.isArray(r)){var n=Number(e);if(Number.isInteger(n))return r[n]}else if(r&&"object"==typeof r&&"function"!=typeof e)return r[e];return r}},c=function(r){if(0!==r.length){var n=Number(r);if(!Number.isNaN(n))return n}},l=function(r){var n=c(r);return void 0!==n?n:function(r){if(u.test(r)){var n=Date.parse(r);if(!Number.isNaN(n))return n}}(r)},m=function(r,n,e){if(i.test(r)){if(!o.test(r))return c(r)||0;if(0===n&&1<e.length&&!p.test(e[1].toString())&&!a.test(e[1].toString()))return c(r)||0;if(0<n&&"."!==e[n-1])return c(r)||0}return r.replace(t," ").replace(f,"")},b=function(r){var n;return(n=r,n.replace(e,"\0$1\0").replace(/\0$/,"").replace(/^\0/,"").split("\0")).map(m)},N=function(r){return Number.isNaN(r)||r instanceof Number&&Number.isNaN(r.valueOf())},v=function(r){if("string"==typeof r||r instanceof String||("number"==typeof r||r instanceof Number)&&!N(r)||"boolean"==typeof r||r instanceof Boolean||r instanceof Date){var n="boolean"==typeof(t=r)||t instanceof Boolean?Number(t).toString():"number"==typeof t||t instanceof Number?t.toString():t instanceof Date?t.getTime().toString():"string"==typeof t||t instanceof String?t.toLowerCase().replace(f,""):"",e=l(n);return{parsedNumber:e,chunks:b(e?""+e:n),value:r}}var t,i,u,o,a,s;return{isArray:Array.isArray(r),isFunction:(s=r,"function"==typeof s),isNaN:N(r),isNull:(a=r,null===a),isObject:(o=r,!(null===o||"object"!=typeof o||Array.isArray(o)||o instanceof Number||o instanceof String||o instanceof Boolean||o instanceof Date)),isSymbol:(u=r,"symbol"==typeof u),isUndefined:(i=r,void 0===i),value:r}},g=function(t,r,e){var i=r.length?r.map(s):[function(r){return r}],n=t.map(function(n,r){return{index:r,values:i.map(function(r){return r(n)}).map(v)}});return n.sort(function(r,n){return function(r,n,e){for(var t=r.index,i=r.values,u=n.index,o=n.values,a=i.length,s=e.length,f=0;f<a;f++){var c=f<s?e[f]:null;if(c&&"function"==typeof c){var l=c(i[f].value,o[f].value);if(l)return l}else{var y=d(i[f],o[f]);if(y)return y*("desc"===c?-1:1)}}return t-u}(r,n,e)}),n.map(function(r){return n=t,e=r.index,n[e];var n,e})};var A=function(r){return"string"==typeof r&&("asc"===r||"desc"===r)};return r.orderBy=function(r,n,e){if(!r||!Array.isArray(r))return[];var t=function(r){if(!r)return[];var n=Array.isArray(r)?[].concat(r):[r];return n.some(function(r){return"string"!=typeof r&&"number"!=typeof r&&"function"!=typeof r})?[]:n}(n),i=function(r){if(!r)return[];var n=Array.isArray(r)?[].concat(r):[r];return n.some(function(r){return"asc"!==r&&"desc"!==r&&"function"!=typeof r})?[]:n}(e);return g(r,t,i)},r.compare=function(r){var n,e,i,t=(e="asc","string"==typeof(n=r)&&A(n)?e=n:n&&"object"==typeof n&&n.order&&A(n.order)&&(e=n.order),{order:e});return i=t,function(r,n){var e=v(r),t=v(n);return d(e,t)*("desc"===i.order?-1:1)}},r}({});
{
"name": "natural-orderby",
"version": "1.1.1",
"version": "2.0.0",
"description": "Lightweight and performant natural sorting of arrays and collections by differentiating between unicode characters, numbers, dates, etc.",

@@ -5,0 +5,0 @@ "main": "cjs/natural-orderby.js",

@@ -231,11 +231,5 @@ # 🌲 natural-orderby

// Default sort order case-sensitive
// Case-insensitive sort order
orderBy(['A', 'b', 'C', 'd', 'E', 'f']);
// => ['A', 'C', 'E', 'b', 'd', 'f']
// Enabled case-insensitive sort order
orderBy(['A', 'C', 'E', 'b', 'd', 'f'], [v => v.toLowerCase()]);
orderBy(['A', 'C', 'E', 'b', 'd', 'f']);
// => ['A', 'b', 'C', 'd', 'E', 'f']

@@ -347,6 +341,6 @@

| Type | Value |
| :--------------- | :-------------------------------------------------------------------- |
| `CompareOptions` | <code>{ caseSensitive?: boolean, order?: 'asc' &#124; 'desc' }</code> |
| `CompareFn` | <code>(valueA: mixed, valueB: mixed) => number</code> |
| Type | Value |
| :--------------- | :---------------------------------------------------- |
| `CompareOptions` | <code>{ order?: 'asc' &#124; 'desc' }</code> |
| `CompareFn` | <code>(valueA: mixed, valueB: mixed) => number</code> |

@@ -357,4 +351,2 @@ #### Description

If `options` or its property `caseSensitive` is unspecified, values are sorted case sensitive. Otherwise, specify `true` for case sensitive or `false` for case insensitive sorting.
If `options` or its property `order` is unspecified, values are sorted in ascending sort order. Otherwise, specify an order of `'desc'` for descending or `'asc'` for ascending sort order of values.

@@ -419,11 +411,5 @@

// Default sort order case-sensitive
// Case-insensitive sort order
['A', 'b', 'C', 'd', 'E', 'f'].sort(compare());
// => ['A', 'C', 'E', 'b', 'd', 'f']
// Enabled case-insensitive sort order
['A', 'C', 'E', 'b', 'd', 'f'].sort(compare({ caseSensitive: false }));
['A', 'C', 'E', 'b', 'd', 'f'].sort(compare());
// => ['A', 'b', 'C', 'd', 'E', 'f']

@@ -552,4 +538,4 @@

Licensed under the MIT License, Copyright © 2018 Olaf Ennen.
Licensed under the MIT License, Copyright © 2018 - present Olaf Ennen.
See [LICENSE](./LICENSE) for more information.

Sorry, the diff of this file is not supported yet

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