mirror of
https://github.com/titanscouting/tra-analysis.git
synced 2024-11-13 22:56:18 +00:00
24 lines
451 B
JavaScript
24 lines
451 B
JavaScript
|
'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
|
||
|
}
|