diff options
author | Rich Trott <rtrott@gmail.com> | 2019-02-06 08:05:24 +0300 |
---|---|---|
committer | Rich Trott <rtrott@gmail.com> | 2019-02-08 11:01:09 +0300 |
commit | 5d609bb11c4c4b73f86100363430010b663f0775 (patch) | |
tree | 62ff89568f2269961114e93be2d8b8ad0fe1af7f /lib/internal/assert.js | |
parent | 64745c3ade8bad694fffba06736b461ab9a05a1d (diff) |
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/internal/assert.js')
-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 00000000000..b5eb88c93b6 --- /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; |