113 lines
4.8 KiB
JSON
113 lines
4.8 KiB
JSON
{
|
|
"_args": [
|
|
[
|
|
{
|
|
"raw": "es6-promisify@^5.0.0",
|
|
"scope": null,
|
|
"escapedName": "es6-promisify",
|
|
"name": "es6-promisify",
|
|
"rawSpec": "^5.0.0",
|
|
"spec": ">=5.0.0 <6.0.0",
|
|
"type": "range"
|
|
},
|
|
"/Volumes/2009-SSD/GT2/GT2-iOS/node_modules/agent-base"
|
|
]
|
|
],
|
|
"_from": "es6-promisify@>=5.0.0 <6.0.0",
|
|
"_id": "es6-promisify@5.0.0",
|
|
"_inCache": true,
|
|
"_location": "/es6-promisify",
|
|
"_nodeVersion": "6.6.0",
|
|
"_npmOperationalInternal": {
|
|
"host": "packages-12-west.internal.npmjs.com",
|
|
"tmp": "tmp/es6-promisify-5.0.0.tgz_1475062709197_0.16741771437227726"
|
|
},
|
|
"_npmUser": {
|
|
"name": "digitaldesignlabs",
|
|
"email": "hello@digitaldesignlabs.com"
|
|
},
|
|
"_npmVersion": "3.10.8",
|
|
"_phantomChildren": {},
|
|
"_requested": {
|
|
"raw": "es6-promisify@^5.0.0",
|
|
"scope": null,
|
|
"escapedName": "es6-promisify",
|
|
"name": "es6-promisify",
|
|
"rawSpec": "^5.0.0",
|
|
"spec": ">=5.0.0 <6.0.0",
|
|
"type": "range"
|
|
},
|
|
"_requiredBy": [
|
|
"/agent-base"
|
|
],
|
|
"_resolved": "https://registry.npmjs.org/es6-promisify/-/es6-promisify-5.0.0.tgz",
|
|
"_shasum": "5109d62f3e56ea967c4b63505aef08291c8a5203",
|
|
"_shrinkwrap": null,
|
|
"_spec": "es6-promisify@^5.0.0",
|
|
"_where": "/Volumes/2009-SSD/GT2/GT2-iOS/node_modules/agent-base",
|
|
"author": {
|
|
"name": "Mike Hall",
|
|
"email": "mikehall314@gmail.com"
|
|
},
|
|
"bugs": {
|
|
"url": "http://github.com/digitaldesignlabs/es6-promisify/issues"
|
|
},
|
|
"dependencies": {
|
|
"es6-promise": "^4.0.3"
|
|
},
|
|
"description": "Converts callback-based functions to ES6 Promises",
|
|
"devDependencies": {
|
|
"babel-preset-es2015": "^6.9.0",
|
|
"eslint": "^2.13.1",
|
|
"gulp": "^3.9.1",
|
|
"gulp-babel": "^6.1.2",
|
|
"nodeunit": "^0.10.0"
|
|
},
|
|
"directories": {},
|
|
"dist": {
|
|
"shasum": "5109d62f3e56ea967c4b63505aef08291c8a5203",
|
|
"tarball": "https://registry.npmjs.org/es6-promisify/-/es6-promisify-5.0.0.tgz"
|
|
},
|
|
"files": [
|
|
"dist/promisify.js",
|
|
"dist/promise.js"
|
|
],
|
|
"gitHead": "7eb2f5e9ae858742d495978efebafaee6719da97",
|
|
"greenkeeper": {
|
|
"ignore": [
|
|
"eslint"
|
|
]
|
|
},
|
|
"homepage": "https://github.com/digitaldesignlabs/es6-promisify#readme",
|
|
"keywords": [
|
|
"promises",
|
|
"es6",
|
|
"promisify"
|
|
],
|
|
"license": "MIT",
|
|
"main": "dist/promisify.js",
|
|
"maintainers": [
|
|
{
|
|
"name": "digitaldesignlabs",
|
|
"email": "hello@digitaldesignlabs.com"
|
|
},
|
|
{
|
|
"name": "mikehall314",
|
|
"email": "mikehall314@gmail.com"
|
|
}
|
|
],
|
|
"name": "es6-promisify",
|
|
"optionalDependencies": {},
|
|
"readme": "[![Travis CI](https://travis-ci.org/digitaldesignlabs/es6-promisify.svg)](https://travis-ci.org/digitaldesignlabs/es6-promisify)\n\n# es6-promisify\n\nConverts callback-based functions to Promise-based functions.\n\n## Install\n\nInstall with [npm](https://npmjs.org/package/es6-promisify)\n\n```bash\nnpm install --save es6-promisify\n```\n\n## Example\n\n```js\n\"use strict\";\n\n// Declare variables\nconst promisify = require(\"es6-promisify\");\nconst fs = require(\"fs\");\n\n// Convert the stat function\nconst stat = promisify(fs.stat);\n\n// Now usable as a promise!\nstat(\"example.txt\").then(function (stats) {\n console.log(\"Got stats\", stats);\n}).catch(function (err) {\n console.error(\"Yikes!\", err);\n});\n```\n\n## Promisify methods\n```js\n\"use strict\";\n\n// Declare variables\nconst promisify = require(\"es6-promisify\");\nconst redis = require(\"redis\").createClient(6379, \"localhost\");\n\n// Create a promise-based version of send_command\nconst client = promisify(redis.send_command, redis);\n\n// Send commands to redis and get a promise back\nclient(\"ping\").then(function (pong) {\n console.log(\"Got\", pong);\n}).catch(function (err) {\n console.error(\"Unexpected error\", err);\n}).then(function () {\n redis.quit();\n});\n```\n\n## Handle callback multiple arguments\n```js\n\"use strict\";\n\n// Declare functions\nfunction test(cb) {\n return cb(undefined, 1, 2, 3);\n}\n\n// Declare variables\nconst promisify = require(\"es6-promisify\");\n\n// Create promise-based version of test\nconst single = promisify(test);\nconst multi = promisify(test, {multiArgs: true});\n\n// Discards additional arguments\nsingle().then(function (result) {\n console.log(result); // 1\n});\n\n// Returns all arguments as an array\nmulti().then(function (result) {\n console.log(result); // [1, 2, 3]\n});\n```\n\n### Tests\nTest with nodeunit\n```bash\n$ npm test\n```\n\nPublished under the [MIT License](http://opensource.org/licenses/MIT).\n",
|
|
"readmeFilename": "README.md",
|
|
"repository": {
|
|
"type": "git",
|
|
"url": "git+https://github.com/digitaldesignlabs/es6-promisify.git"
|
|
},
|
|
"scripts": {
|
|
"pretest": "./node_modules/eslint/bin/eslint.js ./lib/*.js ./tests/*.js",
|
|
"test": "gulp && nodeunit tests"
|
|
},
|
|
"version": "5.0.0"
|
|
}
|