From 1f60dae1371cce66a9a0726981dd3c893ba44cd3 Mon Sep 17 00:00:00 2001 From: David Baker Date: Wed, 23 Oct 2024 14:52:54 +0300 Subject: [PATCH] Eliminate need for Node assert --- index.js | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/index.js b/index.js index e100ca6..6930244 100644 --- a/index.js +++ b/index.js @@ -1,6 +1,13 @@ 'use strict'; -var assert = require('assert'); +var assert = { + ok(cond, msg) { + if (!cond) { + throw new Error(msg); + } + } +}; + var tzdata = require('./lib/tzdata.js'); exports.tzdata = tzdata; @@ -85,7 +92,7 @@ function passthrough(fn) { // there should be no _Date objects in user code when using MockDate. real_date = this; } else { - assert(false, 'Unexpected object type'); + assert.ok(false, 'Unexpected object type'); } return real_date[fn].apply(real_date, arguments); }; @@ -292,7 +299,7 @@ function unregister(glob) { } } if (glob.Date === MockDate) { - assert(_Date); + assert.ok(_Date, 'need to pass a date'); glob.Date = _Date; } }