deprecate

deprecate.js

Methods

(static) deprecate(message, fn) → {function}

Decorate a function with a deprecation message the first time it is called.

Parameters:
NameTypeDescription
messagestring

A deprecation message to log the first time the returned function is called.

fnfunction

The function to be deprecated.

Returns:

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.

Type: 
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:
NameTypeDescription
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:

The decorated function

Type: 
function