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

should-format

Package Overview
Dependencies
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

should-format - npm Package Compare versions

Comparing version 1.0.0 to 2.0.0

20

cjs/should-format.js

@@ -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 @@ };

6

package.json
{
"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": [

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