Welcome to mirror list, hosted at ThFree Co, Russian Federation.

package.json « wrappy « node_modules - github.com/npm/cli.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: a617a72bb24187b9e5f45d4b850a9698b45b76b0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
{
  "name": "wrappy",
  "version": "1.0.1",
  "description": "Callback wrapping utility",
  "main": "wrappy.js",
  "directories": {
    "test": "test"
  },
  "dependencies": {},
  "devDependencies": {
    "tap": "^0.4.12"
  },
  "scripts": {
    "test": "tap test/*.js"
  },
  "repository": {
    "type": "git",
    "url": "git+https://github.com/npm/wrappy.git"
  },
  "author": {
    "name": "Isaac Z. Schlueter",
    "email": "i@izs.me",
    "url": "http://blog.izs.me/"
  },
  "license": "ISC",
  "bugs": {
    "url": "https://github.com/npm/wrappy/issues"
  },
  "homepage": "https://github.com/npm/wrappy",
  "readme": "# wrappy\n\nCallback wrapping utility\n\n## USAGE\n\n```javascript\nvar wrappy = require(\"wrappy\")\n\n// var wrapper = wrappy(wrapperFunction)\n\n// make sure a cb is called only once\n// See also: http://npm.im/once for this specific use case\nvar once = wrappy(function (cb) {\n  var called = false\n  return function () {\n    if (called) return\n    called = true\n    return cb.apply(this, arguments)\n  }\n})\n\nfunction printBoo () {\n  console.log('boo')\n}\n// has some rando property\nprintBoo.iAmBooPrinter = true\n\nvar onlyPrintOnce = once(printBoo)\n\nonlyPrintOnce() // prints 'boo'\nonlyPrintOnce() // does nothing\n\n// random property is retained!\nassert.equal(onlyPrintOnce.iAmBooPrinter, true)\n```\n",
  "readmeFilename": "README.md",
  "_id": "wrappy@1.0.1",
  "_shasum": "1e65969965ccbc2db4548c6b84a6f2c5aedd4739",
  "_resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.1.tgz",
  "_from": "wrappy@>=1.0.1 <1.1.0"
}