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: ce690f78eb1f67de8200bd3ee33da00c2fc50d82 (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
25
26
27
28
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)
        })
      }
    }
  }
}