source: node_modules/es-toolkit/dist/compat/function/wrap.mjs@ a762898

Last change on this file since a762898 was a762898, checked in by istevanoska <ilinastevanoska@…>, 5 months ago

Added visualizations

  • Property mode set to 100644
File size: 327 bytes
Line 
1import { identity } from '../../function/identity.mjs';
2import { isFunction } from '../../predicate/isFunction.mjs';
3
4function wrap(value, wrapper) {
5 return function (...args) {
6 const wrapFn = isFunction(wrapper) ? wrapper : identity;
7 return wrapFn.apply(this, [value, ...args]);
8 };
9}
10
11export { wrap };
Note: See TracBrowser for help on using the repository browser.