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

depr-check.js « utils « lib - github.com/npm/cli.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: aa728a33637effbfc16c685888559e9f54f6d991 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
'use strict'

const log = require('npmlog')

const deprecated = {}
const deprWarned = {}

module.exports = deprCheck
function deprCheck (data) {
  if (deprecated[data._id])
    data.deprecated = deprecated[data._id]

  if (data.deprecated) {
    deprecated[data._id] = data.deprecated
    if (!deprWarned[data._id]) {
      deprWarned[data._id] = true
      log.warn('deprecated', '%s: %s', data._id, data.deprecated)
    }
  }

  return data
}