basant307/AI_Governance_Project
045
1import createWrap from './_createWrap.js';2import flatRest from './_flatRest.js';3 4/** Used to compose bitmasks for function metadata. */5var WRAP_REARG_FLAG = 256;6 7/**8 * Creates a function that invokes `func` with arguments arranged according9 * to the specified `indexes` where the argument value at the first index is10 * provided as the first argument, the argument value at the second index is11 * provided as the second argument, and so on.12 *13 * @static14 * @memberOf _15 * @since 3.0.016 * @category Function17 * @param {Function} func The function to rearrange arguments for.18 * @param {...(number|number[])} indexes The arranged argument indexes.19 * @returns {Function} Returns the new function.20 * @example21 *22 * var rearged = _.rearg(function(a, b, c) {23 * return [a, b, c];24 * }, [2, 0, 1]);25 *26 * rearged('b', 'c', 'a')27 * // => ['a', 'b', 'c']28 */29var rearg = flatRest(function(func, indexes) {30 return createWrap(func, WRAP_REARG_FLAG, undefined, undefined, undefined, indexes);31});32 33export default rearg;34 