should-format
Advanced tools
Comparing version 1.0.0 to 2.0.0
@@ -39,6 +39,24 @@ 'use strict'; | ||
function looksLikeANumber(n) { | ||
return !!n.match(/\d+/); | ||
} | ||
function keyCompare(a, b) { | ||
var aNum = looksLikeANumber(a); | ||
var bNum = looksLikeANumber(b); | ||
if(aNum && bNum) { | ||
return 1*a - 1*b; | ||
} else if(aNum && !bNum) { | ||
return -1; | ||
} else if(!aNum && bNum) { | ||
return 1; | ||
} else { | ||
return a.localeCompare(b); | ||
} | ||
} | ||
function genKeysFunc(f) { | ||
return function(value) { | ||
var k = f(value); | ||
k.sort(); | ||
k.sort(keyCompare); | ||
return k; | ||
@@ -45,0 +63,0 @@ }; |
@@ -35,6 +35,24 @@ import getType from 'should-type'; | ||
function looksLikeANumber(n) { | ||
return !!n.match(/\d+/); | ||
} | ||
function keyCompare(a, b) { | ||
var aNum = looksLikeANumber(a); | ||
var bNum = looksLikeANumber(b); | ||
if(aNum && bNum) { | ||
return 1*a - 1*b; | ||
} else if(aNum && !bNum) { | ||
return -1; | ||
} else if(!aNum && bNum) { | ||
return 1; | ||
} else { | ||
return a.localeCompare(b); | ||
} | ||
} | ||
function genKeysFunc(f) { | ||
return function(value) { | ||
var k = f(value); | ||
k.sort(); | ||
k.sort(keyCompare); | ||
return k; | ||
@@ -41,0 +59,0 @@ }; |
{ | ||
"name": "should-format", | ||
"version": "1.0.0", | ||
"version": "2.0.0", | ||
"description": "Formatting of objects for should.js", | ||
@@ -15,3 +15,3 @@ "main": "cjs/should-format.js", | ||
"cjs": "rollup --format=cjs --output=cjs/should-format.js index.js", | ||
"es6": "rollup --format=es6 --output=es6/should-format.js index.js", | ||
"es6": "rollup --format=es --output=es6/should-format.js index.js", | ||
"build": "npm run cjs && npm run es6", | ||
@@ -31,3 +31,3 @@ "prepublish": "npm run build", | ||
"mocha-better-spec-reporter": "latest", | ||
"rollup": "^0.26.3" | ||
"rollup": "0.34.1" | ||
}, | ||
@@ -34,0 +34,0 @@ "files": [ |
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
No README
QualityPackage does not have a README. This may indicate a failed publish or a low quality package.
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
31320
840
0
4
1
0