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
sumomo-0.7.3 data/sumomo/api_modules/node_modules/lodash/constant.js
sumomo-0.7.2 data/sumomo/api_modules/node_modules/lodash/constant.js
sumomo-0.7.1 data/sumomo/api_modules/node_modules/lodash/constant.js
sumomo-0.6.4 data/sumomo/api_modules/node_modules/lodash/constant.js
sumomo-0.6.3 data/sumomo/api_modules/node_modules/lodash/constant.js
sumomo-0.6.2 data/sumomo/api_modules/node_modules/lodash/constant.js
sumomo-0.6.1 data/sumomo/api_modules/node_modules/lodash/constant.js
affiliator-0.2.1 node_modules/lodash/constant.js
sumomo-0.6.0 data/sumomo/api_modules/node_modules/lodash/constant.js
guard-sass-lint-0.1.2 node_modules/lodash/constant.js
guard-sass-lint-0.1.1 node_modules/lodash/constant.js
lanes-0.8.0 node_modules/globule/node_modules/lodash/constant.js
lanes-0.8.0 node_modules/lodash/constant.js
minimum_viable_product-0.0.11 test/dummy/node_modules/lodash/constant.js
babel-schmooze-sprockets-0.1.3 node_modules/lodash/constant.js
babel-schmooze-sprockets-0.1.2 node_modules/lodash/constant.js
babel-schmooze-sprockets-0.1.1 node_modules/babel-register/node_modules/lodash/constant.js
babel-schmooze-sprockets-0.1.1 node_modules/babel-core/node_modules/lodash/constant.js
babel-schmooze-sprockets-0.1.1 node_modules/babel-generator/node_modules/lodash/constant.js