UNPKG

es-toolkit

Version:

A state-of-the-art, high-performance JavaScript utility library with a small bundle size and strong type annotations.

16 lines (11 loc) 440 B
'use strict'; Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); const identity = require('../../function/identity.js'); const isFunction = require('../../predicate/isFunction.js'); function wrap(value, wrapper) { return function (...args) { const wrapFn = isFunction.isFunction(wrapper) ? wrapper : identity.identity; return wrapFn.apply(this, [value, ...args]); }; } exports.wrap = wrap;