Sha256: 0d2537e86a9e5ae85d8e53910d779895179035c9daa35555874ec19f1225c224

Contents?: true

Size: 685 Bytes

Versions: 1036

Compression:

Stored size: 685 Bytes

Contents

# wrappy

Callback wrapping utility

## USAGE

```javascript
var wrappy = require("wrappy")

// var wrapper = wrappy(wrapperFunction)

// make sure a cb is called only once
// See also: http://npm.im/once for this specific use case
var once = wrappy(function (cb) {
  var called = false
  return function () {
    if (called) return
    called = true
    return cb.apply(this, arguments)
  }
})

function printBoo () {
  console.log('boo')
}
// has some rando property
printBoo.iAmBooPrinter = true

var onlyPrintOnce = once(printBoo)

onlyPrintOnce() // prints 'boo'
onlyPrintOnce() // does nothing

// random property is retained!
assert.equal(onlyPrintOnce.iAmBooPrinter, true)
```

Version data entries

1,036 entries across 414 versions & 47 rubygems

Version Path
rapid_stack-0.2.0 templates/frontend/node_modules/wrappy/README.md
rapid_stack-0.1.1 templates/FrontEnd/node_modules/wrappy/README.md
rapid_stack-0.1.0 templates/FrontEnd/node_modules/wrappy/README.md
immosquare-cleaner-0.1.60 node_modules/wrappy/README.md
immosquare-cleaner-0.1.59 node_modules/wrappy/README.md
immosquare-cleaner-0.1.58 node_modules/wrappy/README.md
immosquare-cleaner-0.1.57 node_modules/wrappy/README.md
immosquare-cleaner-0.1.56 node_modules/wrappy/README.md
immosquare-cleaner-0.1.55 node_modules/wrappy/README.md
immosquare-cleaner-0.1.54 node_modules/wrappy/README.md
immosquare-cleaner-0.1.53 node_modules/wrappy/README.md
immosquare-cleaner-0.1.52 node_modules/wrappy/README.md
trusty-cms-6.3.1 node_modules/wrappy/README.md
immosquare-cleaner-0.1.51 node_modules/wrappy/README.md
boring_generators-0.15.0 tmp/templates/app_template/node_modules/wrappy/README.md
immosquare-cleaner-0.1.50 node_modules/wrappy/README.md
immosquare-cleaner-0.1.49 node_modules/wrappy/README.md
immosquare-cleaner-0.1.48 node_modules/wrappy/README.md
immosquare-cleaner-0.1.47 node_modules/wrappy/README.md
immosquare-cleaner-0.1.46 node_modules/wrappy/README.md