|
|
|
|
|
"use strict"; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
exports.wrap = function (func, msg) { |
|
|
var wrapped = function () { |
|
|
exports.printWarning(msg); |
|
|
return func.apply(this, arguments); |
|
|
}; |
|
|
if (func.prototype) { |
|
|
wrapped.prototype = func.prototype; |
|
|
} |
|
|
return wrapped; |
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
exports.defaultMsg = function (packageName, funcName) { |
|
|
return `${packageName}.${funcName} is deprecated and will be removed from the public API in a future version of ${packageName}.`; |
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
exports.printWarning = function (msg) { |
|
|
|
|
|
if (typeof process === "object" && process.emitWarning) { |
|
|
|
|
|
process.emitWarning(msg); |
|
|
} else if (console.info) { |
|
|
console.info(msg); |
|
|
} else { |
|
|
console.log(msg); |
|
|
} |
|
|
}; |
|
|
|