Sha256: 79ca7e2ca5e995494427ea9eeaee425fc00aadf22010458f97c5ef045a0d6db2

Contents?: true

Size: 1.15 KB

Versions: 276

Compression:

Stored size: 1.15 KB

Contents

var baseRest = require('./_baseRest'),
    toInteger = require('./toInteger');

/** Error message constants. */
var FUNC_ERROR_TEXT = 'Expected a function';

/**
 * Creates a function that invokes `func` with the `this` binding of the
 * created function and arguments from `start` and beyond provided as
 * an array.
 *
 * **Note:** This method is based on the
 * [rest parameter](https://mdn.io/rest_parameters).
 *
 * @static
 * @memberOf _
 * @since 4.0.0
 * @category Function
 * @param {Function} func The function to apply a rest parameter to.
 * @param {number} [start=func.length-1] The start position of the rest parameter.
 * @returns {Function} Returns the new function.
 * @example
 *
 * var say = _.rest(function(what, names) {
 *   return what + ' ' + _.initial(names).join(', ') +
 *     (_.size(names) > 1 ? ', & ' : '') + _.last(names);
 * });
 *
 * say('hello', 'fred', 'barney', 'pebbles');
 * // => 'hello fred, barney, & pebbles'
 */
function rest(func, start) {
  if (typeof func != 'function') {
    throw new TypeError(FUNC_ERROR_TEXT);
  }
  start = start === undefined ? start : toInteger(start);
  return baseRest(func, start);
}

module.exports = rest;

Version data entries

276 entries across 274 versions & 30 rubygems

Version Path
rapid_stack-0.2.0 templates/frontend/node_modules/lodash/rest.js
rapid_stack-0.1.1 templates/FrontEnd/node_modules/lodash/rest.js
rapid_stack-0.1.0 templates/FrontEnd/node_modules/lodash/rest.js
immosquare-cleaner-0.1.60 node_modules/lodash/rest.js
immosquare-cleaner-0.1.59 node_modules/lodash/rest.js
immosquare-cleaner-0.1.58 node_modules/lodash/rest.js
immosquare-cleaner-0.1.57 node_modules/lodash/rest.js
immosquare-cleaner-0.1.56 node_modules/lodash/rest.js
immosquare-cleaner-0.1.55 node_modules/lodash/rest.js
immosquare-cleaner-0.1.54 node_modules/lodash/rest.js
immosquare-cleaner-0.1.53 node_modules/lodash/rest.js
immosquare-cleaner-0.1.52 node_modules/lodash/rest.js
trusty-cms-6.3.1 node_modules/lodash/rest.js
immosquare-cleaner-0.1.51 node_modules/lodash/rest.js
boring_generators-0.15.0 tmp/templates/app_template/node_modules/lodash/rest.js
clapton-0.0.26 lib/clapton/javascripts/node_modules/lodash/rest.js
clapton-0.0.25 lib/clapton/javascripts/node_modules/lodash/rest.js
immosquare-cleaner-0.1.50 node_modules/lodash/rest.js
clapton-0.0.24 lib/clapton/javascripts/node_modules/lodash/rest.js
clapton-0.0.23 lib/clapton/javascripts/node_modules/lodash/rest.js