Linux unitednationsplay.com 3.10.0-1160.45.1.el7.x86_64 #1 SMP Wed Oct 13 17:20:51 UTC 2021 x86_64
nginx/1.20.1
Server IP : 188.130.139.92 & Your IP : 18.221.40.13
Domains :
Cant Read [ /etc/named.conf ]
User : web
Terminal
Auto Root
Create File
Create Folder
Localroot Suggester
Backdoor Destroyer
Readme
/
home /
www /
unp-musonza /
node_modules /
universalify /
Delete
Unzip
Name
Size
Permission
Date
Action
LICENSE
1.07
KB
-rw-r--r--
1985-10-26 08:15
README.md
1.96
KB
-rw-r--r--
1985-10-26 08:15
index.js
777
B
-rw-r--r--
1985-10-26 08:15
package.json
1.6
KB
-rw-r--r--
2021-02-04 21:24
Save
Rename
# universalify [](https://travis-ci.org/RyanZim/universalify)    Make a callback- or promise-based function support both promises and callbacks. Uses the native promise implementation. ## Installation ```bash npm install universalify ``` ## API ### `universalify.fromCallback(fn)` Takes a callback-based function to universalify, and returns the universalified function. Function must take a callback as the last parameter that will be called with the signature `(error, result)`. `universalify` does not support calling the callback with more than three arguments, and does not ensure that the callback is only called once. ```js function callbackFn (n, cb) { setTimeout(() => cb(null, n), 15) } const fn = universalify.fromCallback(callbackFn) // Works with Promises: fn('Hello World!') .then(result => console.log(result)) // -> Hello World! .catch(error => console.error(error)) // Works with Callbacks: fn('Hi!', (error, result) => { if (error) return console.error(error) console.log(result) // -> Hi! }) ``` ### `universalify.fromPromise(fn)` Takes a promise-based function to universalify, and returns the universalified function. Function must return a valid JS promise. `universalify` does not ensure that a valid promise is returned. ```js function promiseFn (n) { return new Promise(resolve => { setTimeout(() => resolve(n), 15) }) } const fn = universalify.fromPromise(promiseFn) // Works with Promises: fn('Hello World!') .then(result => console.log(result)) // -> Hello World! .catch(error => console.error(error)) // Works with Callbacks: fn('Hi!', (error, result) => { if (error) return console.error(error) console.log(result) // -> Hi! }) ``` ## License MIT