MCPcopy Index your code
hub / github.com/apache/pouchdb / once

Function once

lib/index.js:92–104  ·  view source on GitHub ↗
(fun)

Source from the content-addressed store, hash-verified

90}
91
92function once(fun) {
93 var called = false;
94 return function (...args) {
95 /* istanbul ignore if */
96 if (called) {
97 // this is a smoke test and should never actually happen
98 throw new Error('once called more than once');
99 } else {
100 called = true;
101 fun.apply(this, args);
102 }
103 };
104}
105
106function toPromise(func) {
107 //create the function we will be returning

Callers 2

toPromiseFunction · 0.70
constructorMethod · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…