chore: allow for callback => promise deprecation (#15758)
* chore: allow for callback => promise deprecation * cb type check is sufficient * migrate warn to always trigger
This commit is contained in:
parent
51cb36fa9b
commit
a45d5960d7
1 changed files with 19 additions and 0 deletions
|
@ -67,6 +67,25 @@ const deprecate = {
|
|||
})
|
||||
},
|
||||
|
||||
promisify: (promise, cb) => {
|
||||
const oldName = `${promise.name} with callbacks`
|
||||
const newName = `${promise.name} with Promises`
|
||||
const warn = warnOnce(oldName, newName)
|
||||
|
||||
if (typeof cb !== 'function') return promise
|
||||
warn()
|
||||
return promise
|
||||
.then(res => {
|
||||
process.nextTick(() => {
|
||||
cb(null, res)
|
||||
})
|
||||
}, err => {
|
||||
process.nextTick(() => {
|
||||
cb(err)
|
||||
})
|
||||
})
|
||||
},
|
||||
|
||||
renameProperty: (o, oldName, newName) => {
|
||||
const warn = warnOnce(oldName, newName)
|
||||
|
||||
|
|
Loading…
Reference in a new issue