1module.exports = warnDeprecated 2 3var log = require('npmlog') 4 5var deprecations = {} 6 7function warnDeprecated (type) { 8 return function warn (messages, instance) { 9 if (!instance) { 10 if (!deprecations[type]) { 11 deprecations[type] = {} 12 messages.forEach(function (m) { log.warn(type, m) }) 13 } 14 } else { 15 if (!deprecations[type]) deprecations[type] = {} 16 17 if (!deprecations[type][instance]) { 18 deprecations[type][instance] = true 19 messages.forEach(function (m) { log.warn(type, m) }) 20 } 21 } 22 } 23} 24