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 message
string A deprecation message to log the first time the returned function is called.
fn
function 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 major
number The major version where it will be removed
oldName
string The old function name
newName
string The new function name
fn
function The function to deprecate
Returns:
function -The decorated function