string-natural-compare
Advanced tools
Comparing version 2.0.2 to 2.0.3
@@ -80,2 +80,10 @@ 'use strict'; | ||
if (aIndex >= lengthA && bIndex < lengthB && lengthA >= lengthB) { | ||
return -1; | ||
} | ||
if (bIndex >= lengthB && aIndex < lengthA && lengthB >= lengthA) { | ||
return 1; | ||
} | ||
return lengthA - lengthB; | ||
@@ -93,6 +101,9 @@ } | ||
}, | ||
set: function(value) { | ||
alphabet = value; | ||
alphabetIndexMap = []; | ||
var i = 0; | ||
if (alphabet) { | ||
@@ -103,3 +114,5 @@ for (; i < alphabet.length; i++) { | ||
} | ||
alphabetIndexMapLength = alphabetIndexMap.length; | ||
for (i = 0; i < alphabetIndexMapLength; i++) { | ||
@@ -106,0 +119,0 @@ if (alphabetIndexMap[i] === undefined) { |
{ | ||
"name": "string-natural-compare", | ||
"version": "2.0.2", | ||
"version": "2.0.3", | ||
"description": "Compare alphanumeric strings the same way a human would, using a natural order algorithm", | ||
@@ -9,4 +9,3 @@ "author": "Nathan Woltman <nwoltman@outlook.com>", | ||
"files": [ | ||
"natural-compare.js", | ||
"LICENSE.txt" | ||
"natural-compare.js" | ||
], | ||
@@ -22,11 +21,11 @@ "repository": { | ||
"devDependencies": { | ||
"coveralls": "^2.11.9", | ||
"grunt": "~1.0.1", | ||
"grunt-eslint": "^19.0.0", | ||
"grunt-mocha-istanbul": "^5.0.1", | ||
"grunt-mocha-test": "^0.13.2", | ||
"istanbul": "^0.4.3", | ||
"coveralls": "^3.0.2", | ||
"grunt": "~1.0.3", | ||
"grunt-eslint": "^21.0.0", | ||
"grunt-mocha-istanbul": "^5.0.2", | ||
"grunt-mocha-test": "^0.13.3", | ||
"istanbul": "^0.4.5", | ||
"jit-grunt": "^0.10.0", | ||
"mocha": "^3.1.2", | ||
"should": "^11.1.1" | ||
"mocha": "^5.2.0", | ||
"should": "^13.2.1" | ||
}, | ||
@@ -33,0 +32,0 @@ "scripts": { |
@@ -34,3 +34,7 @@ # String Natural Compare | ||
```sh | ||
# npm | ||
npm install string-natural-compare --save | ||
# yarn | ||
yarn add string-natural-compare | ||
``` | ||
@@ -65,3 +69,4 @@ | ||
); | ||
// -> 1 (a number > 0) | ||
// -> 1 | ||
// Other inputs with the same ordering as this may yield a different number > 0 | ||
@@ -68,0 +73,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
9306
98
122