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.27 node_modules/lodash/constant.js
immosquare-cleaner-0.1.26 node_modules/lodash/constant.js
immosquare-cleaner-0.1.25 node_modules/lodash/constant.js
immosquare-cleaner-0.1.24 node_modules/lodash/constant.js
immosquare-cleaner-0.1.23 node_modules/lodash/constant.js
sumomo-0.10.4 data/sumomo/api_modules/node_modules/lodash/constant.js
sumomo-0.10.3 data/sumomo/api_modules/node_modules/lodash/constant.js
sumomo-0.10.2 data/sumomo/api_modules/node_modules/lodash/constant.js
sumomo-0.10.1 data/sumomo/api_modules/node_modules/lodash/constant.js
sumomo-0.10.0 data/sumomo/api_modules/node_modules/lodash/constant.js
reed_sdk-1.0.1 node_modules/lodash/constant.js
reed_sdk-1.0.0 node_modules/lodash/constant.js
boring_generators-0.12.0 tmp/templates/app_template/node_modules/lodash/constant.js
sumomo-0.9.0 data/sumomo/api_modules/node_modules/lodash/constant.js
sumomo-0.8.22 data/sumomo/api_modules/node_modules/lodash/constant.js
sumomo-0.8.21 data/sumomo/api_modules/node_modules/lodash/constant.js
sumomo-0.8.20 data/sumomo/api_modules/node_modules/lodash/constant.js
sumomo-0.8.17 data/sumomo/api_modules/node_modules/lodash/constant.js
sumomo-0.8.16 data/sumomo/api_modules/node_modules/lodash/constant.js
disco_app-0.18.0 test/dummy/node_modules/lodash/constant.js