{"name":"value-or-function","version":"3.0.0","description":"Normalize a value or function, applying extra args to the function","author":{"name":"Gulp Team","email":"team@gulpjs.com","url":"http://gulpjs.com/"},"contributors":[{"name":"Blaine Bublitz","email":"blaine.bublitz@gmail.com"},{"name":"Hugo Wood","email":"hx4.5@free.fr"}],"repository":{"type":"git","url":"git+https://github.com/gulpjs/value-or-function.git"},"license":"MIT","engines":{"node":">= 0.10"},"main":"index.js","files":["index.js"],"scripts":{"lint":"eslint . && jscs index.js test/","pretest":"npm run lint","test":"mocha --async-only","cover":"istanbul cover node_modules/mocha/bin/_mocha --report lcovonly","coveralls":"npm run cover && istanbul-coveralls"},"dependencies":{},"devDependencies":{"eslint":"^1.10.3","eslint-config-gulp":"^2.0.0","expect":"^1.16.0","istanbul":"^0.4.3","istanbul-coveralls":"^1.0.3","jscs":"^2.3.5","jscs-preset-gulp":"^1.0.0","mocha":"^2.4.5"},"keywords":["options","normalize","value","function"],"gitHead":"44e5b5808a46a6e22fee66ad2508d2d1a0e1477c","bugs":{"url":"https://github.com/gulpjs/value-or-function/issues"},"homepage":"https://github.com/gulpjs/value-or-function#readme","_id":"value-or-function@3.0.0","_shasum":"1c243a50b595c1be54a754bfece8563b9ff8d813","_from":".","_npmVersion":"2.15.1","_nodeVersion":"0.10.48","_npmUser":{"name":"phated","email":"blaine.bublitz@gmail.com"},"maintainers":[{"name":"contra","email":"contra@wearefractal.com"},{"name":"phated","email":"blaine.bublitz@gmail.com"}],"dist":{"shasum":"1c243a50b595c1be54a754bfece8563b9ff8d813","tarball":"http://registry-npm.ywwl.com/value-or-function/download/value-or-function-3.0.0.tgz","npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJh2/hCCRA9TVsSAnZWagAAoCQP/i0R+zZlUZQmZPHqS8CP\nH/BRxl8WtCAPQAuFpYx0mGh6622BTHroKUhm7GB2EI7LfZOeNQrZO1DE5V4J\n6O4rOTT4mIHf4UQ6t9NMZ4U3QZf92F84VutZIGbsbG77++bXuGr5DqhpU5pI\ni2qT8+YdO6zja1eHs0WYVUOi2hHcn172K4bTk/WgBEZyZ4prm7hUC8YjlONw\nVLtt6BmKbau1QwhsgZpM6dIQjS1nnFFuef1EujHk8Mj5/QJG8WF8aVPu/mtc\nbMrvBjsA4WhHsQcpHdGAOlJFp22u0NPnLTDS5NOJkAcH7QIULHVyHcp+TMSq\nV3ucGRDy0NtSIFjMxEqL0wwrPIyY4eVGTZH6JhjXZ75/E1sFpy9LXCQj6oDl\nOoslLUF2mhQmpGqQDH8Sg9QB4VwOu+TFRHEZHsf1rfrEP0GXDPaWUmwLDnpX\nI4N8OL6TRm3EFJQMBMeEO7YH43bFCv0g8kgV15xdZXG41PnF0pJ9lB9snAhB\nySA8JhQIohBbgSxcMHTfbW8UyaHXMw5sZmNBzEi0FETTqZTunk2nO6VtKMfq\nzA/bdIKrySOdjwA2rPdfN2j+9rmtE8SxHDqpPH+vUjKSGFek8ZAkuI5yVt5w\n4J/Ew8vU2Hl8t2DYSlC6iE7jvEdPEgKYY8fegWkkcJd1BB3xQzkoy46fDLXw\nUet2\r\n=zykq\r\n-----END PGP SIGNATURE-----\r\n","integrity":"sha512-jdBB2FrWvQC/pnPtIqcLsMaQgjhdb6B7tk1MMyTKapox+tQZbdRP4uLxu/JY0t7fbfDCUMnuelzEYv5GsxHhdg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCICmHTh35EllDLeDc8lpNgv3xgWsaMUA/Lxv5pEmsyA2ZAiEA4WqHkuXv/OdpXYO82ko/vtMciiTD0V0KAtPQgVAp16c="}],"size":3314,"noattachment":false,"key":"/value-or-function/-/value-or-function-3.0.0.tgz"},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/value-or-function-3.0.0.tgz_1500670075697_0.5566161137539893"},"directories":{},"readme":"<p align=\"center\">\n  <a href=\"https://gulpjs.com\">\n    <img height=\"257\" width=\"114\" src=\"https://raw.githubusercontent.com/gulpjs/artwork/master/gulp-2x.png\">\n  </a>\n</p>\n\n# value-or-function\n\n[![NPM version][npm-image]][npm-url] [![Downloads][downloads-image]][npm-url] [![Build Status][ci-image]][ci-url] [![Coveralls Status][coveralls-image]][coveralls-url]\n\nNormalize a value or function, applying extra args to the function\n\n## Example\n\n```js\nvar normalize = require('value-or-function');\n\n// Values matching type are returned\nvar isEnabled = normalize('boolean', true);\n// isEnabled === true\n\n// Values not matching type return undefined\nvar isEnabled = normalize('boolean', 1);\n// isEnabled === undefined\n\n// Functions are called\nvar isEnabled = normalize('boolean', function () {\n  return false;\n});\n// isEnabled === false\n\n// Extra arguments are applied to function\nvar count = normalize(\n  'number',\n  function (a, b) {\n    return a + b;\n  },\n  1,\n  2\n);\n// count === 3\n\n// Supply the function with context\nvar context = { c: 3 };\nvar count = normalize.call(\n  context,\n  'number',\n  function (a, b) {\n    return a + b + this.c;\n  },\n  1,\n  2\n);\n// count === 6\n\n// Values one of multiple types are returned\nvar isEnabled = normalize(['string', 'boolean'], true);\n// isEnabled === true\n\n// Provide a function as first argument to do custom coercion\nvar now = new Date();\nvar enabledSince = normalize(function (value) {\n  if (value.constructor === Date) {\n    return value;\n  }\n}, now);\n// enabledSince === now\n\n// Convenience methods are available for the built-in types\nvar result = normalize.object({});\nvar result = normalize.number(1);\nvar result = normalize.string('');\nvar result = normalize.symbol(Symbol());\nvar result = normalize.boolean(true);\nvar result = normalize.function(function () {});\nvar result = normalize.date(new Date());\n```\n\n## API\n\n### `normalize(coercer, value[, ...appliedArguments])`\n\nTakes a coercer function `coercer` to transform `value` to the desired type.\nAlso optionally takes any extra arguments to apply to `value` if `value` is a function.\n\nIf the return value of `coercer(value)` is not `null` or `undefined`, that value is returned.\nOtherwise, if `value` is a function, that function is called with any extra arguments\nsupplied to `normalize`, and its return value is passed through the coercer.\n\nIf `coercer` is a string, it must be one of the built-in types (see below)\nand the appropriate default coercer is invoked, optionally first reducing `value`\nto a primitive type with `.valueOf()` if it is an Object.\n\nIf `coercer` is an array, each element is tried until one returns something other\nthan `null` or `undefined`, or it results in `undefined` if all of the elements yield `null` or `undefined`.\n\n#### `normalize.object(value[, ...appliedArguments])`\n\nConvenience method for `normalize('object', ...)`.\n\n#### `normalize.number(value[, ...appliedArguments])`\n\nConvenience method for `normalize('number', ...)`.\n\n#### `normalize.string(value[, ...appliedArguments])`\n\nConvenience method for `normalize('string', ...)`.\n\n#### `normalize.symbol(value[, ...appliedArguments])`\n\nConvenience method for `normalize('symbol', ...)`.\n\n#### `normalize.boolean(value[, ...appliedArguments])`\n\nConvenience method for `normalize('boolean', ...)`.\n\n#### `normalize.function(value[, ...appliedArguments])`\n\nConvenience method for `normalize('function', ...)`.\n\n#### `normalize.date(value[, ...appliedArguments])`\n\nConvenience method for `normalize('date', ...)`.\n\n## License\n\nMIT\n\n<!-- prettier-ignore-start -->\n[downloads-image]: https://img.shields.io/npm/dm/value-or-function.svg?style=flat-square\n[npm-url]: https://npmjs.org/package/value-or-function\n[npm-image]: https://img.shields.io/npm/v/value-or-function.svg?style=flat-square\n\n[ci-url]: https://github.com/gulpjs/value-or-function/actions?query=workflow:dev\n[ci-image]: https://img.shields.io/github/workflow/status/gulpjs/value-or-function/dev?style=flat-square\n\n[coveralls-url]: https://coveralls.io/r/gulpjs/value-or-function\n[coveralls-image]: https://img.shields.io/coveralls/gulpjs/value-or-function/master.svg?style=flat-square\n<!-- prettier-ignore-end -->\n","publish_time":1500670078213,"_cnpm_publish_time":1500670078213,"dist-tags":{"latest":"4.0.0"}}