fix(cached-dns.lookup): don't use assert/strict

Fixes #6202

Only available on Node >=15.
This commit is contained in:
Julien Fontanet 2022-04-24 15:28:30 +02:00
parent c9475ddc65
commit e69f58eb86

View File

@ -1,6 +1,6 @@
'use strict' 'use strict'
const assert = require('assert/strict') const assert = require('assert')
const dns = require('dns') const dns = require('dns')
const LRU = require('lru-cache') const LRU = require('lru-cache')
@ -29,7 +29,7 @@ exports.createCachedLookup = function createCachedLookup({ lookup = dns.lookup }
} else if (typeof options === 'number') { } else if (typeof options === 'number') {
family = options family = options
} else if (options != null) { } else if (options != null) {
assert.notEqual(options.verbatim, false, 'not supported by this implementation') assert.notStrictEqual(options.verbatim, false, 'not supported by this implementation')
;({ all = all, family = family } = options) ;({ all = all, family = family } = options)
} }
@ -63,7 +63,7 @@ exports.createCachedLookup = function createCachedLookup({ lookup = dns.lookup }
const previous = dns.lookup const previous = dns.lookup
dns.lookup = cachedLookup dns.lookup = cachedLookup
return function restoreGlobal() { return function restoreGlobal() {
assert.equal(dns.lookup, cachedLookup) assert.strictEqual(dns.lookup, cachedLookup)
dns.lookup = previous dns.lookup = previous
} }
} }