source: node_modules/es-toolkit/dist/compat/function/wrap.js

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

Added visualizations

  • Property mode set to 100644
File size: 440 bytes
Line 
1'use strict';
2
3Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
5const identity = require('../../function/identity.js');
6const isFunction = require('../../predicate/isFunction.js');
7
8function wrap(value, wrapper) {
9 return function (...args) {
10 const wrapFn = isFunction.isFunction(wrapper) ? wrapper : identity.identity;
11 return wrapFn.apply(this, [value, ...args]);
12 };
13}
14
15exports.wrap = wrap;
Note: See TracBrowser for help on using the repository browser.