Comparing version 1.4.0 to 1.5.0
19
index.js
@@ -22,2 +22,19 @@ (function initLazyAss() { | ||
/* | ||
custom JSON.stringify replacer to make sure we do not | ||
hide properties that have value "undefined" | ||
var o = { | ||
foo: 42, | ||
bar: undefined | ||
} | ||
// standard JSON.stringify returns '{"foo": 42}' | ||
// this replacer returns '{"foo": 42, "bar": null}' | ||
*/ | ||
function replacer(key, value) { | ||
if (value === undefined) { | ||
return null; | ||
} | ||
return value; | ||
} | ||
function toString(arg, k) { | ||
@@ -39,3 +56,3 @@ if (isPrimitive(arg)) { | ||
try { | ||
argString = JSON.stringify(arg, null, 2); | ||
argString = JSON.stringify(arg, replacer, 2); | ||
} catch (err) { | ||
@@ -42,0 +59,0 @@ argString = '{ cannot stringify arg ' + k + ', it has type "' + typeof arg + '"'; |
{ | ||
"name": "lazy-ass", | ||
"description": "Lazy assertions without performance penalty", | ||
"version": "1.4.0", | ||
"version": "1.5.0", | ||
"author": { | ||
@@ -6,0 +6,0 @@ "name": "Gleb Bahmutov", |
@@ -117,3 +117,3 @@ # lazy-ass | ||
If the condition itself is an instance of Error, it is simply rethrown (synchronously or | ||
asynchronously). | ||
asynchronously). | ||
@@ -125,3 +125,3 @@ ```js | ||
Useful to make sure errors in the promise chains are | ||
Useful to make sure errors in the promise chains are | ||
[not silently ignored](https://glebbahmutov.com/blog/why-promises-need-to-be-done/). | ||
@@ -246,7 +246,7 @@ | ||
[lazy-ass-icon]: https://nodei.co/npm/lazy-ass.png?downloads=true | ||
[lazy-ass-icon]: https://nodei.co/npm/lazy-ass.svg?downloads=true | ||
[lazy-ass-url]: https://npmjs.org/package/lazy-ass | ||
[lazy-ass-ci-image]: https://travis-ci.org/bahmutov/lazy-ass.png?branch=master | ||
[lazy-ass-ci-image]: https://travis-ci.org/bahmutov/lazy-ass.svg?branch=master | ||
[lazy-ass-ci-url]: https://travis-ci.org/bahmutov/lazy-ass | ||
[lazy-ass-coverage-image]: https://coveralls.io/repos/bahmutov/lazy-ass/badge.png | ||
[lazy-ass-coverage-image]: https://coveralls.io/repos/bahmutov/lazy-ass/badge.svg | ||
[lazy-ass-coverage-url]: https://coveralls.io/r/bahmutov/lazy-ass | ||
@@ -257,7 +257,7 @@ [lazy-ass-code-climate-image]: https://codeclimate.com/github/bahmutov/lazy-ass/badges/gpa.svg | ||
[lazy-ass-codacy-url]: https://www.codacy.com/public/bahmutov/lazy-ass.git | ||
[lazy-ass-dependencies-image]: https://david-dm.org/bahmutov/lazy-ass.png | ||
[lazy-ass-dependencies-image]: https://david-dm.org/bahmutov/lazy-ass.svg | ||
[lazy-ass-dependencies-url]: https://david-dm.org/bahmutov/lazy-ass | ||
[lazy-ass-devdependencies-image]: https://david-dm.org/bahmutov/lazy-ass/dev-status.png | ||
[lazy-ass-devdependencies-image]: https://david-dm.org/bahmutov/lazy-ass/dev-status.svg | ||
[lazy-ass-devdependencies-url]: https://david-dm.org/bahmutov/lazy-ass#info=devDependencies | ||
[semantic-image]: https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg | ||
[semantic-url]: https://github.com/semantic-release/semantic-release |
Sorry, the diff of this file is not supported yet
19163
179