1 var wrappy = require('wrappy')
2 module.exports = wrappy(once)
3 module.exports.strict = wrappy(onceStrict)
5 once.proto = once(function () {
6 Object.defineProperty(Function.prototype, 'once', {
13 Object.defineProperty(Function.prototype, 'onceStrict', {
15 return onceStrict(this)
23 if (f.called) return f.value
25 return f.value = fn.apply(this, arguments)
31 function onceStrict (fn) {
34 throw new Error(f.onceError)
36 return f.value = fn.apply(this, arguments)
38 var name = fn.name || 'Function wrapped with `once`'
39 f.onceError = name + " shouldn't be called more than once"