deprecate.js
Methods
-
static deprecate(message, fn) → {function}
-
Decorate a function with a deprecation message the first time it is called.
Parameters:
Name Type Description messagestring A deprecation message to log the first time the returned function is called.
fnfunction The function to be deprecated.
Returns:
function -A wrapper function that will log a deprecation warning the first time it is called. The return value will be the return value of the wrapped function.
-
static deprecateForMajor(major, oldName, newName, fn) → {function}
-
Internal function used to mark a function as deprecated in the next major version with consistent messaging.
Parameters:
Name Type Description majornumber The major version where it will be removed
oldNamestring The old function name
newNamestring The new function name
fnfunction The function to deprecate
Returns:
function -The decorated function