Skip to content

Commit 12efdcf

Browse files
committed
Expose strict mode functionality
1 parent 3d981b5 commit 12efdcf

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

assert.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -483,6 +483,18 @@ assert.doesNotThrow = function(block, /*optional*/error, /*optional*/message) {
483483

484484
assert.ifError = function(err) { if (err) throw err; };
485485

486+
// Expose a strict only variant of assert
487+
function strict(value, message) {
488+
if (!value) fail(value, true, message, '==', strict);
489+
}
490+
assert.strict = Object.assign(strict, assert, {
491+
equal: assert.strictEqual,
492+
deepEqual: assert.deepStrictEqual,
493+
notEqual: assert.notStrictEqual,
494+
notDeepEqual: assert.notDeepStrictEqual
495+
});
496+
assert.strict.strict = assert.strict;
497+
486498
var objectKeys = Object.keys || function (obj) {
487499
var keys = [];
488500
for (var key in obj) {

0 commit comments

Comments
 (0)