• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1'use strict'
2
3const log = require('npmlog')
4
5const deprecated = {}
6const deprWarned = {}
7
8module.exports = deprCheck
9function deprCheck (data) {
10  if (deprecated[data._id]) {
11    data.deprecated = deprecated[data._id]
12  }
13
14  if (data.deprecated) {
15    deprecated[data._id] = data.deprecated
16    if (!deprWarned[data._id]) {
17      deprWarned[data._id] = true
18      log.warn('deprecated', '%s: %s', data._id, data.deprecated)
19    }
20  }
21
22  return data
23}
24