Welcome to mirror list, hosted at ThFree Co, Russian Federation.

warn-deprecated.js « utils « lib - github.com/npm/cli.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: ec821b9bd495b19faeb4c108a9aadc6ad6f36b37 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
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) })
      }
    }
  }
}