99 lines
4.3 KiB
JSON
99 lines
4.3 KiB
JSON
{
|
|
"_args": [
|
|
[
|
|
{
|
|
"raw": "universalify@^0.1.0",
|
|
"scope": null,
|
|
"escapedName": "universalify",
|
|
"name": "universalify",
|
|
"rawSpec": "^0.1.0",
|
|
"spec": ">=0.1.0 <0.2.0",
|
|
"type": "range"
|
|
},
|
|
"/Volumes/2009-SSD/GT2/GT2-iOS/node_modules/fs-extra"
|
|
]
|
|
],
|
|
"_from": "universalify@>=0.1.0 <0.2.0",
|
|
"_id": "universalify@0.1.1",
|
|
"_inCache": true,
|
|
"_location": "/universalify",
|
|
"_nodeVersion": "7.8.0",
|
|
"_npmOperationalInternal": {
|
|
"host": "s3://npm-registry-packages",
|
|
"tmp": "tmp/universalify-0.1.1.tgz_1500561668015_0.5723595882300287"
|
|
},
|
|
"_npmUser": {
|
|
"name": "ryanzim",
|
|
"email": "opensrc@ryanzim.com"
|
|
},
|
|
"_npmVersion": "4.2.0",
|
|
"_phantomChildren": {},
|
|
"_requested": {
|
|
"raw": "universalify@^0.1.0",
|
|
"scope": null,
|
|
"escapedName": "universalify",
|
|
"name": "universalify",
|
|
"rawSpec": "^0.1.0",
|
|
"spec": ">=0.1.0 <0.2.0",
|
|
"type": "range"
|
|
},
|
|
"_requiredBy": [
|
|
"/fs-extra",
|
|
"/xdl/fs-extra"
|
|
],
|
|
"_resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.1.tgz",
|
|
"_shasum": "fa71badd4437af4c148841e3b3b165f9e9e590b7",
|
|
"_shrinkwrap": null,
|
|
"_spec": "universalify@^0.1.0",
|
|
"_where": "/Volumes/2009-SSD/GT2/GT2-iOS/node_modules/fs-extra",
|
|
"author": {
|
|
"name": "Ryan Zimmerman",
|
|
"email": "opensrc@ryanzim.com"
|
|
},
|
|
"bugs": {
|
|
"url": "https://github.com/RyanZim/universalify/issues"
|
|
},
|
|
"dependencies": {},
|
|
"description": "Make a callback- or promise-based function support both promises and callbacks.",
|
|
"devDependencies": {
|
|
"colortape": "^0.1.2",
|
|
"nyc": "^10.2.0",
|
|
"standard": "^10.0.1",
|
|
"tape": "^4.6.3"
|
|
},
|
|
"directories": {},
|
|
"dist": {
|
|
"shasum": "fa71badd4437af4c148841e3b3b165f9e9e590b7",
|
|
"tarball": "https://registry.npmjs.org/universalify/-/universalify-0.1.1.tgz"
|
|
},
|
|
"files": [
|
|
"index.js"
|
|
],
|
|
"gitHead": "6dcade29ad1fc945f3d2a6e63cf92ec041fa83d2",
|
|
"homepage": "https://github.com/RyanZim/universalify#readme",
|
|
"keywords": [
|
|
"callback",
|
|
"native",
|
|
"promise"
|
|
],
|
|
"license": "MIT",
|
|
"maintainers": [
|
|
{
|
|
"name": "ryanzim",
|
|
"email": "opensrc@ryanzim.com"
|
|
}
|
|
],
|
|
"name": "universalify",
|
|
"optionalDependencies": {},
|
|
"readme": "# universalify\n\n[![Travis branch](https://img.shields.io/travis/RyanZim/universalify/master.svg)](https://travis-ci.org/RyanZim/universalify)\n\nMake a callback- or promise-based function support both promises and callbacks.\n\nUses the native promise implementation.\n\n## Installation\n\n```bash\nnpm install universalify\n```\n\n## API\n\n### `universalify.fromCallback(fn)`\n\nTakes a callback-based function to universalify, and returns the universalified function.\n\nFunction 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.\n\n```js\nfunction callbackFn (n, cb) {\n setTimeout(() => cb(null, n), 15)\n}\n\nconst fn = universalify.fromCallback(callbackFn)\n\n// Works with Promises:\nfn('Hello World!')\n.then(result => console.log(result)) // -> Hello World!\n.catch(error => console.error(error))\n\n// Works with Callbacks:\nfn('Hi!', (error, result) => {\n if (error) return console.error(error)\n console.log(result)\n // -> Hi!\n})\n```\n\n### `universalify.fromPromise(fn)`\n\nTakes a promise-based function to universalify, and returns the universalified function.\n\nFunction must return a valid JS promise. `universalify` does not ensure that a valid promise is returned.\n\n```js\nfunction promiseFn (n) {\n return new Promise(resolve => {\n setTimeout(() => resolve(n), 15)\n })\n}\n\nconst fn = universalify.fromPromise(promiseFn)\n\n// Works with Promises:\nfn('Hello World!')\n.then(result => console.log(result)) // -> Hello World!\n.catch(error => console.error(error))\n\n// Works with Callbacks:\nfn('Hi!', (error, result) => {\n if (error) return console.error(error)\n console.log(result)\n // -> Hi!\n})\n```\n\n## License\n\nMIT\n",
|
|
"readmeFilename": "README.md",
|
|
"repository": {
|
|
"type": "git",
|
|
"url": "git+https://github.com/RyanZim/universalify.git"
|
|
},
|
|
"scripts": {
|
|
"test": "standard && nyc tape test/*.js | colortape"
|
|
},
|
|
"version": "0.1.1"
|
|
}
|