node/deps/npm/lib/utils/warn-deprecated.js
Rebecca Turner 41923c0c07 deps: upgrade npm to 3.3.6
PR-URL: https://github.com/nodejs/node/pull/3310
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
2015-10-22 13:56:09 -04:00

24 lines
556 B
JavaScript

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) })
}
}
}
}