Skip to content

Commit

Permalink
no need to re-implement process.noDeprecation
Browse files Browse the repository at this point in the history
Also, the unbounded memory warning isn't a deprecation warning.
  • Loading branch information
isaacs committed Mar 17, 2022
1 parent 23708c7 commit c5707e3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
6 changes: 4 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,11 @@ const deprecatedProperty = (field, instead) => {
warn(code, `${field} property`, `cache.${instead}`, get)
}
}
const shouldWarn = (code) => typeof process === 'object' &&

const shouldWarn = code => typeof process === 'object' &&
process &&
!(process.noDeprecation || warned.has(code))
!warned.has(code)

const warn = (code, what, instead, fn) => {
warned.add(code)
process.emitWarning(`The ${what} is deprecated. Please use ${instead} instead.`, 'DeprecationWarning', code, fn)
Expand Down
1 change: 0 additions & 1 deletion test/deprecations.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
const t = require('tap')
const LRU = require('../')

process.noDeprecation = false
const warnings = []
process.emitWarning = (...w) => warnings.push(w)

Expand Down

0 comments on commit c5707e3

Please sign in to comment.