Sha256: 13f0f4ed40b5861f35c3647afe29e7d880556a46b7781992edd9739e77baeb00

Contents?: true

Size: 528 Bytes

Versions: 279

Compression:

Stored size: 528 Bytes

Contents

/**
 * Creates a function that returns `value`.
 *
 * @static
 * @memberOf _
 * @since 2.4.0
 * @category Util
 * @param {*} value The value to return from the new function.
 * @returns {Function} Returns the new constant function.
 * @example
 *
 * var objects = _.times(2, _.constant({ 'a': 1 }));
 *
 * console.log(objects);
 * // => [{ 'a': 1 }, { 'a': 1 }]
 *
 * console.log(objects[0] === objects[1]);
 * // => true
 */
function constant(value) {
  return function() {
    return value;
  };
}

module.exports = constant;

Version data entries

279 entries across 275 versions & 31 rubygems

Version Path
immosquare-cleaner-0.1.60 node_modules/lodash/constant.js
immosquare-cleaner-0.1.59 node_modules/lodash/constant.js
immosquare-cleaner-0.1.58 node_modules/lodash/constant.js
immosquare-cleaner-0.1.57 node_modules/lodash/constant.js
immosquare-cleaner-0.1.56 node_modules/lodash/constant.js
immosquare-cleaner-0.1.55 node_modules/lodash/constant.js
immosquare-cleaner-0.1.54 node_modules/lodash/constant.js
immosquare-cleaner-0.1.53 node_modules/lodash/constant.js
immosquare-cleaner-0.1.52 node_modules/lodash/constant.js
trusty-cms-6.3.1 node_modules/lodash/constant.js
immosquare-cleaner-0.1.51 node_modules/lodash/constant.js
boring_generators-0.15.0 tmp/templates/app_template/node_modules/lodash/constant.js
clapton-0.0.26 lib/clapton/javascripts/node_modules/lodash/constant.js
clapton-0.0.25 lib/clapton/javascripts/node_modules/lodash/constant.js
immosquare-cleaner-0.1.50 node_modules/lodash/constant.js
clapton-0.0.24 lib/clapton/javascripts/node_modules/lodash/constant.js
clapton-0.0.23 lib/clapton/javascripts/node_modules/lodash/constant.js
clapton-0.0.22 lib/clapton/javascripts/node_modules/lodash/constant.js
clapton-0.0.21 lib/clapton/javascripts/node_modules/lodash/constant.js
clapton-0.0.20 lib/clapton/javascripts/node_modules/lodash/constant.js