diff options
author | Rich Trott <rtrott@gmail.com> | 2019-02-05 21:05:24 -0800 |
---|---|---|
committer | Rich Trott <rtrott@gmail.com> | 2019-02-08 00:01:09 -0800 |
commit | 5d609bb11c4c4b73f86100363430010b663f0775 (patch) | |
tree | 62ff89568f2269961114e93be2d8b8ad0fe1af7f /lib | |
parent | 64745c3ade8bad694fffba06736b461ab9a05a1d (diff) | |
download | android-node-v8-5d609bb11c4c4b73f86100363430010b663f0775.tar.gz android-node-v8-5d609bb11c4c4b73f86100363430010b663f0775.tar.bz2 android-node-v8-5d609bb11c4c4b73f86100363430010b663f0775.zip |
assert: create internal/assert micro-module
For use in built-in modules that could benefit from `assert()` without
having to load the entire module (unless an AssertionError actually
occurs): lib/internal/assert.js.
PR-URL: https://github.com/nodejs/node/pull/25956
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Minwoo Jung <minwoo@nodesource.com>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/internal/assert.js | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/internal/assert.js b/lib/internal/assert.js new file mode 100644 index 0000000000..b5eb88c93b --- /dev/null +++ b/lib/internal/assert.js @@ -0,0 +1,9 @@ +'use strict'; + +function assert(value, message) { + if (!value) { + require('assert')(value, message); + } +} + +module.exports = assert; |