WrapSpec

Provides configuration for wrapping functions.

Constructor

new WrapSpec(params)

Parameters:
NameTypeDescription
paramsWrapSpecParams
Example
function toWrap (a, b) {}
const wrapped = shim.wrap(toWrap, {
  matchArity: true,
  wrapper: function () {
    return function wrappedFn () {}
  }
})
assert.equal(toWrap.length, wrapped.length)

Members

matchArity :boolean

Indicates that the arity of the wrapper should match the arity of the function being wrapped.

Type:
  • boolean

wrapper :function

A function that wraps another function.

Type:
  • function