Home Reference Source Test Repository

buildDocs/utils/returnAtIndex.js

/**
 * Creates a function the returns the specific index.
 * @private
 * @export
 * @param {Function} fn
 * @param {number} index
 * @returns {Function}
 */
/**
 * Creates a function the returns the specific index.
 * @private
 * @export
 * @param {Function} fn
 * @param {number} index
 * @returns {Function}
 */ export function returnAtIndex(fn, index) {
    return function (...args) {
        fn.call(this, ...args);
        return args[index];
    };
}