mirror of https://github.com/lukechilds/node.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
560 B
24 lines
560 B
module.exports = warnDeprecated
|
|
|
|
var log = require("npmlog")
|
|
|
|
var deprecations = {}
|
|
|
|
function warnDeprecated (type) {
|
|
return function warn (messages, instance) {
|
|
if (!instance) {
|
|
if (!deprecations[type]) {
|
|
deprecations[type] = {}
|
|
messages.forEach(function (m) { log.warn(type, m) })
|
|
}
|
|
}
|
|
else {
|
|
if (!deprecations[type]) deprecations[type] = {}
|
|
|
|
if (!deprecations[type][instance]) {
|
|
deprecations[type][instance] = true
|
|
messages.forEach(function (m) { log.warn(type, m) })
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|