Git Product home page Git Product logo

wrappy's Introduction

wrappy

Callback wrapping utility

USAGE

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)

wrappy's People

Contributors

amilajack avatar isaacs avatar jamestalmage avatar othiym23 avatar stevemao avatar wraithgar avatar zkat avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

wrappy's Issues

Error: Cannot find module 'wrappy'

Hello,

I am really struggling with this one, I emailed the community at npm, but no reply.
When installing Node.js on windows 10 pro 64 bit and type npm -v in the command I get the below error:

module.js:471
    throw err;
    ^

Error: Cannot find module 'wrappy'
    at Function.Module._resolveFilename (module.js:469:15)
    at Function.Module._load (module.js:417:25)
    at Module.require (module.js:497:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (C:\Users\Benny\AppData\Roaming\npm\node_modules\npm\node_modules\once\once.js:1:76)
    at Module._compile (module.js:570:32)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)

Any idea why please? Noone has been able to help me at the moment.

I uninstalled, reinstalled Node.js, tried really everything I could, same error again and again.

Thank you!

`Cannot read property 'find' of undefined` when installing wrappy.

I first encountered this error when trying to install grunt-cli and looking at the logs traced it back to when npm is trying to install wrappy. It's only been an issue since upgrading to Node 8 / NPM 5.0.1

When trying to install wrappy, I'm encountering the following error:

➜  project git:(alpha) npm install -g grunt-cli                   
npm ERR! Cannot read property 'find' of undefined

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/jasonshultz/.npm/_logs/2017-06-02T12_50_10_206Z-debug.log
➜  project git:(alpha) npm install -g wrappy
added 1 package in 37.495s
➜  project git:(alpha) 

The error is happening around line 246:

0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/bin/node',
1 verbose cli   '/usr/local/bin/npm',
1 verbose cli   'install',
1 verbose cli   '-g',
1 verbose cli   'grunt-cli' ]
2 info using [email protected]
3 info using [email protected]
4 silly install loadCurrentTree
5 silly install readGlobalPackageData
6 http fetch GET 304 https://registry.npmjs.org/grunt-cli 202ms (from cache)
7 silly pacote tag manifest for grunt-cli@latest fetched in 235ms
8 silly install loadIdealTree
9 silly install cloneCurrentTreeToIdealTree
10 silly install loadShrinkwrap
11 silly install loadAllDepsIntoIdealTree
12 silly resolveWithNewModule [email protected] checking installable status
13 http fetch GET 304 https://registry.npmjs.org/grunt-known-options 84ms (from cache)
14 silly pacote range manifest for grunt-known-options@~1.1.0 fetched in 88ms
15 silly resolveWithNewModule [email protected] checking installable status
16 http fetch GET 304 https://registry.npmjs.org/nopt 126ms (from cache)
17 silly pacote range manifest for nopt@~3.0.6 fetched in 129ms
18 silly resolveWithNewModule [email protected] checking installable status
19 http fetch GET 304 https://registry.npmjs.org/resolve 316ms (from cache)
20 silly pacote range manifest for resolve@~1.1.0 fetched in 322ms
21 silly resolveWithNewModule [email protected] checking installable status
22 http fetch GET 304 https://registry.npmjs.org/findup-sync 337ms (from cache)
23 silly pacote range manifest for findup-sync@~0.3.0 fetched in 339ms
24 silly resolveWithNewModule [email protected] checking installable status
25 http fetch GET 304 https://registry.npmjs.org/glob 80ms (from cache)
26 silly pacote range manifest for glob@~5.0.0 fetched in 92ms
27 silly resolveWithNewModule [email protected] checking installable status
28 http fetch GET 304 https://registry.npmjs.org/inflight 92ms (from cache)
29 http fetch GET 304 https://registry.npmjs.org/inherits 92ms (from cache)
30 silly pacote range manifest for inherits@2 fetched in 94ms
31 silly resolveWithNewModule [email protected] checking installable status
32 silly pacote range manifest for inflight@^1.0.4 fetched in 95ms
33 silly resolveWithNewModule [email protected] checking installable status
34 http fetch GET 304 https://registry.npmjs.org/once 94ms (from cache)
35 http fetch GET 304 https://registry.npmjs.org/minimatch 96ms (from cache)
36 silly pacote range manifest for once@^1.3.0 fetched in 96ms
37 silly resolveWithNewModule [email protected] checking installable status
38 silly pacote range manifest for minimatch@2 || 3 fetched in 98ms
39 silly resolveWithNewModule [email protected] checking installable status
40 http fetch GET 304 https://registry.npmjs.org/path-is-absolute 114ms (from cache)
41 silly pacote range manifest for path-is-absolute@^1.0.0 fetched in 115ms
42 silly resolveWithNewModule [email protected] checking installable status
43 http fetch GET 304 https://registry.npmjs.org/wrappy 79ms (from cache)
44 silly pacote range manifest for wrappy@1 fetched in 81ms
45 silly resolveWithNewModule [email protected] checking installable status
46 http fetch GET 304 https://registry.npmjs.org/brace-expansion 306ms (from cache)
47 silly pacote range manifest for brace-expansion@^1.1.7 fetched in 307ms
48 silly resolveWithNewModule [email protected] checking installable status
49 http fetch GET 304 https://registry.npmjs.org/balanced-match 82ms (from cache)
50 http fetch GET 304 https://registry.npmjs.org/concat-map 82ms (from cache)
51 silly pacote version manifest for [email protected] fetched in 84ms
52 silly resolveWithNewModule [email protected] checking installable status
53 silly pacote range manifest for balanced-match@^0.4.1 fetched in 84ms
54 silly resolveWithNewModule [email protected] checking installable status
55 http fetch GET 304 https://registry.npmjs.org/abbrev 77ms (from cache)
56 silly pacote range manifest for abbrev@1 fetched in 78ms
57 silly resolveWithNewModule [email protected] checking installable status
58 silly currentTree lib
59 silly idealTree lib
59 silly idealTree └─┬ [email protected]
59 silly idealTree   ├── [email protected]
59 silly idealTree   ├── [email protected]
59 silly idealTree   ├── [email protected]
59 silly idealTree   ├── [email protected]
59 silly idealTree   ├── [email protected]
59 silly idealTree   ├── [email protected]
59 silly idealTree   ├── [email protected]
59 silly idealTree   ├── [email protected]
59 silly idealTree   ├── [email protected]
59 silly idealTree   ├── [email protected]
59 silly idealTree   ├── [email protected]
59 silly idealTree   ├── [email protected]
59 silly idealTree   ├── [email protected]
59 silly idealTree   ├── [email protected]
59 silly idealTree   └── [email protected]
60 silly install generateActionsToTake
61 silly diffTrees action count 16
62 silly diffTrees add [email protected]
63 silly diffTrees add [email protected]
64 silly diffTrees add [email protected]
65 silly diffTrees add [email protected]
66 silly diffTrees add [email protected]
67 silly diffTrees add [email protected]
68 silly diffTrees add [email protected]
69 silly diffTrees add [email protected]
70 silly diffTrees add [email protected]
71 silly diffTrees add [email protected]
72 silly diffTrees add [email protected]
73 silly diffTrees add [email protected]
74 silly diffTrees add [email protected]
75 silly diffTrees add [email protected]
76 silly diffTrees add [email protected]
77 silly diffTrees add [email protected]
78 silly decomposeActions action count 128
79 silly decomposeActions fetch [email protected]
80 silly decomposeActions extract [email protected]
81 silly decomposeActions preinstall [email protected]
82 silly decomposeActions build [email protected]
83 silly decomposeActions install [email protected]
84 silly decomposeActions postinstall [email protected]
85 silly decomposeActions finalize [email protected]
86 silly decomposeActions refresh-package-json [email protected]
87 silly decomposeActions fetch [email protected]
88 silly decomposeActions extract [email protected]
89 silly decomposeActions preinstall [email protected]
90 silly decomposeActions build [email protected]
91 silly decomposeActions install [email protected]
92 silly decomposeActions postinstall [email protected]
93 silly decomposeActions finalize [email protected]
94 silly decomposeActions refresh-package-json [email protected]
95 silly decomposeActions fetch [email protected]
96 silly decomposeActions extract [email protected]
97 silly decomposeActions preinstall [email protected]
98 silly decomposeActions build [email protected]
99 silly decomposeActions install [email protected]
100 silly decomposeActions postinstall [email protected]
101 silly decomposeActions finalize [email protected]
102 silly decomposeActions refresh-package-json [email protected]
103 silly decomposeActions fetch [email protected]
104 silly decomposeActions extract [email protected]
105 silly decomposeActions preinstall [email protected]
106 silly decomposeActions build [email protected]
107 silly decomposeActions install [email protected]
108 silly decomposeActions postinstall [email protected]
109 silly decomposeActions finalize [email protected]
110 silly decomposeActions refresh-package-json [email protected]
111 silly decomposeActions fetch [email protected]
112 silly decomposeActions extract [email protected]
113 silly decomposeActions preinstall [email protected]
114 silly decomposeActions build [email protected]
115 silly decomposeActions install [email protected]
116 silly decomposeActions postinstall [email protected]
117 silly decomposeActions finalize [email protected]
118 silly decomposeActions refresh-package-json [email protected]
119 silly decomposeActions fetch [email protected]
120 silly decomposeActions extract [email protected]
121 silly decomposeActions preinstall [email protected]
122 silly decomposeActions build [email protected]
123 silly decomposeActions install [email protected]
124 silly decomposeActions postinstall [email protected]
125 silly decomposeActions finalize [email protected]
126 silly decomposeActions refresh-package-json [email protected]
127 silly decomposeActions fetch [email protected]
128 silly decomposeActions extract [email protected]
129 silly decomposeActions preinstall [email protected]
130 silly decomposeActions build [email protected]
131 silly decomposeActions install [email protected]
132 silly decomposeActions postinstall [email protected]
133 silly decomposeActions finalize [email protected]
134 silly decomposeActions refresh-package-json [email protected]
135 silly decomposeActions fetch [email protected]
136 silly decomposeActions extract [email protected]
137 silly decomposeActions preinstall [email protected]
138 silly decomposeActions build [email protected]
139 silly decomposeActions install [email protected]
140 silly decomposeActions postinstall [email protected]
141 silly decomposeActions finalize [email protected]
142 silly decomposeActions refresh-package-json [email protected]
143 silly decomposeActions fetch [email protected]
144 silly decomposeActions extract [email protected]
145 silly decomposeActions preinstall [email protected]
146 silly decomposeActions build [email protected]
147 silly decomposeActions install [email protected]
148 silly decomposeActions postinstall [email protected]
149 silly decomposeActions finalize [email protected]
150 silly decomposeActions refresh-package-json [email protected]
151 silly decomposeActions fetch [email protected]
152 silly decomposeActions extract [email protected]
153 silly decomposeActions preinstall [email protected]
154 silly decomposeActions build [email protected]
155 silly decomposeActions install [email protected]
156 silly decomposeActions postinstall [email protected]
157 silly decomposeActions finalize [email protected]
158 silly decomposeActions refresh-package-json [email protected]
159 silly decomposeActions fetch [email protected]
160 silly decomposeActions extract [email protected]
161 silly decomposeActions preinstall [email protected]
162 silly decomposeActions build [email protected]
163 silly decomposeActions install [email protected]
164 silly decomposeActions postinstall [email protected]
165 silly decomposeActions finalize [email protected]
166 silly decomposeActions refresh-package-json [email protected]
167 silly decomposeActions fetch [email protected]
168 silly decomposeActions extract [email protected]
169 silly decomposeActions preinstall [email protected]
170 silly decomposeActions build [email protected]
171 silly decomposeActions install [email protected]
172 silly decomposeActions postinstall [email protected]
173 silly decomposeActions finalize [email protected]
174 silly decomposeActions refresh-package-json [email protected]
175 silly decomposeActions fetch [email protected]
176 silly decomposeActions extract [email protected]
177 silly decomposeActions preinstall [email protected]
178 silly decomposeActions build [email protected]
179 silly decomposeActions install [email protected]
180 silly decomposeActions postinstall [email protected]
181 silly decomposeActions finalize [email protected]
182 silly decomposeActions refresh-package-json [email protected]
183 silly decomposeActions fetch [email protected]
184 silly decomposeActions extract [email protected]
185 silly decomposeActions preinstall [email protected]
186 silly decomposeActions build [email protected]
187 silly decomposeActions install [email protected]
188 silly decomposeActions postinstall [email protected]
189 silly decomposeActions finalize [email protected]
190 silly decomposeActions refresh-package-json [email protected]
191 silly decomposeActions fetch [email protected]
192 silly decomposeActions extract [email protected]
193 silly decomposeActions preinstall [email protected]
194 silly decomposeActions build [email protected]
195 silly decomposeActions install [email protected]
196 silly decomposeActions postinstall [email protected]
197 silly decomposeActions finalize [email protected]
198 silly decomposeActions refresh-package-json [email protected]
199 silly decomposeActions fetch [email protected]
200 silly decomposeActions extract [email protected]
201 silly decomposeActions preinstall [email protected]
202 silly decomposeActions build [email protected]
203 silly decomposeActions install [email protected]
204 silly decomposeActions postinstall [email protected]
205 silly decomposeActions finalize [email protected]
206 silly decomposeActions refresh-package-json [email protected]
207 silly install executeActions
208 silly doSerial global-install 128
209 verbose correctMkdir /Users/jasonshultz/.npm/_locks correctMkdir not in flight; initializing
210 verbose lock using /Users/jasonshultz/.npm/_locks/staging-3a08f0df5026584d.lock for /usr/local/lib/node_modules/.staging
211 silly doParallel extract 128
212 silly extract [email protected]
213 silly pacote trying abbrev@https://registry.npmjs.org/abbrev/-/abbrev-1.1.0.tgz by hash: sha1-0FVMIlZjbi9W58LlrRg/hZQo2B8=
214 silly extract [email protected]
215 silly pacote trying balanced-match@https://registry.npmjs.org/balanced-match/-/balanced-match-0.4.2.tgz by hash: sha1-yz8+PHMtwPAe5wtAPzAuYddwmDg=
216 silly extract [email protected]
217 silly pacote trying concat-map@https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz by hash: sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=
218 silly extract [email protected]
219 silly pacote trying brace-expansion@https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.7.tgz by hash: sha1-Pv/DxQ4ABTH7cg6v+A8K6O8jz1k=
220 silly extract [email protected]
221 silly pacote trying inherits@https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz by hash: sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=
222 silly extract [email protected]
223 silly pacote trying minimatch@https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz by hash: sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==
224 silly extract [email protected]
225 silly pacote trying path-is-absolute@https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz by hash: sha1-F0uSaHNVNP+8es5r9TpanhtcX18=
226 silly extract [email protected]
227 silly pacote trying wrappy@https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz by hash: sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=
228 silly extract [email protected]
229 silly pacote trying once@https://registry.npmjs.org/once/-/once-1.4.0.tgz by hash: sha1-WDsap3WWHUsROsF9nFC6753Xa9E=
230 silly extract [email protected]
231 silly pacote trying inflight@https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz by hash: sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=
232 silly extract [email protected]
233 silly pacote trying glob@https://registry.npmjs.org/glob/-/glob-5.0.15.tgz by hash: sha1-G8k2ueAvSmA/zCIuz3Yz0wuLk7E=
234 silly extract [email protected]
235 silly pacote trying findup-sync@https://registry.npmjs.org/findup-sync/-/findup-sync-0.3.0.tgz by hash: sha1-N5MKpdgWt3fANEXhlmzGeQpMCxY=
236 silly extract [email protected]
237 silly pacote trying grunt-known-options@https://registry.npmjs.org/grunt-known-options/-/grunt-known-options-1.1.0.tgz by hash: sha1-pCdO6zL6dl2lp6OxcSYXzjsUQUk=
238 silly extract [email protected]
239 silly pacote trying nopt@https://registry.npmjs.org/nopt/-/nopt-3.0.6.tgz by hash: sha1-xkZdvwirzU2zWTF/eaxopkayj/k=
240 silly extract [email protected]
241 silly pacote trying resolve@https://registry.npmjs.org/resolve/-/resolve-1.1.7.tgz by hash: sha1-IDEU2CrSxe2ejgQRs5ModeiJ6Xs=
242 silly extract [email protected]
243 silly pacote trying grunt-cli@https://registry.npmjs.org/grunt-cli/-/grunt-cli-1.2.0.tgz by hash: sha1-VisRnrsGndtGSs4oRVAb6Xs1tqg=
244 silly pacote data for sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA== not present. Using manifest.
245 silly pacote brace-expansion@https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.7.tgz extracted to /usr/local/lib/node_modules/.staging/brace-expansion-2db85e18 by content address 68ms
246 verbose stack TypeError: Cannot read property 'find' of undefined
246 verbose stack     at opts.integrity.digests.find.hash (/usr/local/lib/node_modules/npm/node_modules/ssri/index.js:264:33)
246 verbose stack     at Array.find (native)
246 verbose stack     at Transform.on (/usr/local/lib/node_modules/npm/node_modules/ssri/index.js:263:15)
246 verbose stack     at emitNone (events.js:110:20)
246 verbose stack     at Transform.emit (events.js:207:7)
246 verbose stack     at endReadableNT (_stream_readable.js:1045:12)
246 verbose stack     at _combinedTickCallback (internal/process/next_tick.js:102:11)
246 verbose stack     at process._tickCallback (internal/process/next_tick.js:161:9)
247 verbose cwd /Users/jasonshultz/Projects/3form
248 verbose Darwin 16.6.0
249 verbose argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "-g" "grunt-cli"
250 verbose node v8.0.0
251 verbose npm  v5.0.1
252 error Cannot read property 'find' of undefined
253 verbose exit [ 1, true ]

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.