sprintf-kit
Advanced tools
Comparing version 1.0.0 to 1.1.0
@@ -5,3 +5,19 @@ # Change Log | ||
<a name="1.1.0"></a> | ||
# [1.1.0](https://github.com/medikoo/sprintf-kit/compare/v1.0.0...v1.1.0) (2018-05-30) | ||
### Bug Fixes | ||
* signature ([a2d4e62](https://github.com/medikoo/sprintf-kit/commit/a2d4e62)) | ||
### Features | ||
* improve patch message ([4294359](https://github.com/medikoo/sprintf-kit/commit/4294359)) | ||
* improve patch strings format ([d4c56e5](https://github.com/medikoo/sprintf-kit/commit/d4c56e5)) | ||
<a name="1.0.0"></a> | ||
# 1.0.0 (2018-04-09) |
"use strict"; | ||
module.exports = function (value/*, placeholder, formatData*/) { | ||
module.exports = function (value/*, placeholder, argIndex, args*/) { | ||
try { | ||
return String(Number(value)); | ||
} catch (e) { | ||
return "[Non-coercible (to number) value]"; | ||
return "<Non-coercible (to number) value>"; | ||
} | ||
}; |
@@ -7,4 +7,4 @@ "use strict"; | ||
} catch (e) { | ||
return "[Non-coercible (to float) value]"; | ||
return "<Non-coercible (to float) value>"; | ||
} | ||
}; |
@@ -9,4 +9,4 @@ "use strict"; | ||
} catch (e) { | ||
return "[Non-coercible (to integer) value]"; | ||
return "<Non-coercible (to integer) value>"; | ||
} | ||
}; |
@@ -16,7 +16,9 @@ "use strict"; | ||
try { | ||
return JSON.stringify(value, null, " "); | ||
return JSON.stringify(value, null, 2); | ||
} catch (e) { | ||
if (e.message === CIRCULAR_JSON_ERROR_MESSAGE) return "[Circular JSON]"; | ||
return "[Non-serializable (to JSON) value]"; | ||
if (e.message === CIRCULAR_JSON_ERROR_MESSAGE) { | ||
return "<Circular (non-JSON serializable) value>"; | ||
} | ||
return "<Non-serializable (to JSON) value>"; | ||
} | ||
}; |
{ | ||
"name": "sprintf-kit", | ||
"version": "1.0.0", | ||
"version": "1.1.0", | ||
"description": "sprintf parser and basic formatter", | ||
"author": "Mariusz Nowak <medyk@medikoo.com> (http://www.medikoo.com/)", | ||
"keywords": ["printf", "sprintf", "log", "format", "string"], | ||
"repository": { "type": "git", "url": "git://github.com/medikoo/sprintf-kit.git" }, | ||
"dependencies": { "es5-ext": "^0.10.42" }, | ||
"keywords": [ | ||
"printf", | ||
"sprintf", | ||
"log", | ||
"format", | ||
"string" | ||
], | ||
"repository": { | ||
"type": "git", | ||
"url": "git://github.com/medikoo/sprintf-kit.git" | ||
}, | ||
"dependencies": { | ||
"es5-ext": "^0.10.44" | ||
}, | ||
"devDependencies": { | ||
"browserstack-tape-runner": "2", | ||
"eslint": "^4.19.1", | ||
"eslint-config-medikoo-es5": "^1.4.9", | ||
"eslint-config-medikoo-es5": "^1.4.11", | ||
"istanbul": "^0.4.5", | ||
@@ -17,7 +28,9 @@ "tape": "^4.9", | ||
}, | ||
"eslintConfig": { "extends": "medikoo-es5", "root": true }, | ||
"eslintConfig": { | ||
"extends": "medikoo-es5", | ||
"root": true | ||
}, | ||
"scripts": { | ||
"coverage": "tape-index && istanbul cover test.index.js", | ||
"check-coverage": | ||
"npm run coverage && istanbul check-coverage --statements 100 --function 100 --branches 100 --lines 100", | ||
"check-coverage": "npm run coverage && istanbul check-coverage --statements 100 --function 100 --branches 100 --lines 100", | ||
"lint": "eslint --ignore-path=.gitignore .", | ||
@@ -29,3 +42,8 @@ "test": "tape-index && node test.index.js", | ||
"browsers": [ | ||
"chrome_latest", "firefox_latest", "safari_latest", "opera_latest", "ie_11", "edge_latest" | ||
"chrome_current", | ||
"firefox_current", | ||
"safari_current", | ||
"opera_current", | ||
"ie_11", | ||
"edge_current" | ||
] | ||
@@ -32,0 +50,0 @@ }, |
@@ -102,2 +102,6 @@ [![*nix build status][nix-build-image]][nix-build-url] | ||
Project cross-browser compatibility supported by: | ||
<a href="https://browserstack.com"><img src="https://bstacksupport.zendesk.com/attachments/token/Pj5uf2x5GU9BvWErqAr51Jh2R/?name=browserstack-logo-600x315.png" height="150" /></a> | ||
[nix-build-image]: https://semaphoreci.com/api/v1/medikoo-org/sprintf-kit/branches/master/shields_badge.svg | ||
@@ -104,0 +108,0 @@ [nix-build-url]: https://semaphoreci.com/medikoo-org/sprintf-kit |
@@ -8,8 +8,3 @@ "use strict"; | ||
t.equal( | ||
modifier({ | ||
valueOf: function () { | ||
return "32.23"; | ||
} | ||
}), | ||
"32.23", | ||
modifier({ valueOf: function () { return "32.23"; } }), "32.23", | ||
"Numeric representation for non-number value" | ||
@@ -20,7 +15,5 @@ ); | ||
t.equal( | ||
modifier(Object.create(null))[0], | ||
"[", | ||
"meaningful error string for non-corcible value" | ||
modifier(Object.create(null))[0], "<", "meaningful error string for non-corcible value" | ||
); | ||
t.end(); | ||
}); |
@@ -8,8 +8,3 @@ "use strict"; | ||
t.equal( | ||
modifier({ | ||
valueOf: function () { | ||
return "32.23"; | ||
} | ||
}), | ||
"32.23", | ||
modifier({ valueOf: function () { return "32.23"; } }), "32.23", | ||
"Float representation for non-number value" | ||
@@ -21,7 +16,5 @@ ); | ||
t.equal( | ||
modifier(Object.create(null))[0], | ||
"[", | ||
"meaningful error string for non-corcible value" | ||
modifier(Object.create(null))[0], "<", "meaningful error string for non-corcible value" | ||
); | ||
t.end(); | ||
}); |
@@ -8,8 +8,3 @@ "use strict"; | ||
t.equal( | ||
modifier({ | ||
valueOf: function () { | ||
return "32.23"; | ||
} | ||
}), | ||
"32", | ||
modifier({ valueOf: function () { return "32.23"; } }), "32", | ||
"Integer representation for non-number value" | ||
@@ -21,7 +16,5 @@ ); | ||
t.equal( | ||
modifier(Object.create(null))[0], | ||
"[", | ||
"meaningful error string for non-corcible value" | ||
modifier(Object.create(null))[0], "<", "meaningful error string for non-corcible value" | ||
); | ||
t.end(); | ||
}); |
@@ -8,12 +8,8 @@ "use strict"; | ||
t.equal(modifier({ foo: "bar" }), "{\n \"foo\": \"bar\"\n}", "JSON string for JSON object"); | ||
var obj = { | ||
toJSON: function () { | ||
throw new Error("foo"); | ||
} | ||
}; | ||
t.equal(modifier(obj)[0], "[", "meaningful error string for non-serializable value"); | ||
var obj = { toJSON: function () { throw new Error("foo"); } }; | ||
t.equal(modifier(obj)[0], "<", "meaningful error string for non-serializable value"); | ||
obj = {}; | ||
obj.obj = obj; | ||
t.equal(modifier(obj)[0], "[", "meaningful error for circular references"); | ||
t.equal(modifier(obj)[0], "<", "meaningful error for circular references"); | ||
t.end(); | ||
}); |
@@ -8,8 +8,3 @@ "use strict"; | ||
t.equal( | ||
modifier({ | ||
toString: function () { | ||
return "marko"; | ||
} | ||
}), | ||
"marko", | ||
modifier({ toString: function () { return "marko"; } }), "marko", | ||
"String representation for non-string value" | ||
@@ -19,7 +14,5 @@ ); | ||
t.equal( | ||
modifier(Object.create(null))[0], | ||
"[", | ||
"meaningful error string for non-corcible value" | ||
modifier(Object.create(null))[0], "<", "meaningful error string for non-corcible value" | ||
); | ||
t.end(); | ||
}); |
26329
115
702
Updatedes5-ext@^0.10.44