@polkadot/util
Advanced tools
Comparing version 0.6.4 to 0.6.5
@@ -11,8 +11,8 @@ 'use strict'; | ||
@description | ||
Checks that `test` is a true value. If value is `false` (or `false-ish`), it throws an ExtError with the supplied `message` and an optional `code` and `data`. When `test` passes, `true` is returned. | ||
Checks that `test` is a truthy value. If value is falsy (`null`, `undefined`, `false`, ...), it throws an ExtError with the supplied `message` and an optional `code` and `data`. When `test` passes, `true` is returned. | ||
@example | ||
const assert = require('@polkadot/util/assert'); | ||
assert(true === true, 'True should be true'); // true returned | ||
assert(false === true, 'False should not be true'); // ExtError thrown | ||
assert(true, 'True should be true'); // true returned | ||
assert(false, 'False should not be true'); // ExtError thrown | ||
*/ | ||
@@ -23,7 +23,7 @@ module.exports = function assert(test, message) { | ||
if (!test) { | ||
throw new ExtError(message, code, data); | ||
if (test) { | ||
return true; | ||
} | ||
return true; | ||
throw new ExtError(message, code, data); | ||
}; |
{ | ||
"name": "@polkadot/util", | ||
"version": "0.6.4", | ||
"version": "0.6.5", | ||
"description": "A collection of useful utilities for @polkadot", | ||
@@ -32,4 +32,4 @@ "main": "index.js", | ||
"devDependencies": { | ||
"@polkadot/api-jsonrpc": "^0.5.5", | ||
"@polkadot/dev": "^0.12.4" | ||
"@polkadot/api-jsonrpc": "^0.5.9", | ||
"@polkadot/dev": "^0.12.5" | ||
}, | ||
@@ -36,0 +36,0 @@ "dependencies": { |
Sorry, the diff of this file is not supported yet
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
82035