async-method
Advanced tools
Comparing version 0.1.1 to 1.0.0
@@ -1,31 +0,23 @@ | ||
!function() { | ||
'use strict'; | ||
var type = require('ee-types') | ||
, Promise = (Promise || require('es6-promise').Promise); | ||
const type = require('ee-types'); | ||
module.exports = function(method) { | ||
return function(...args) { | ||
// if the last argument is a function, we're working with callbacks | ||
if (type.function(args[args.length -1])) { | ||
method(...args); | ||
} else { | ||
return new Promise((resolve, reject) => { | ||
args.push((err, arg) => { | ||
if (err) reject(err); | ||
else resolve(arg); | ||
}); | ||
module.exports = function(method) { | ||
return function() { | ||
// create an array out of the arguments object | ||
var args = Array.prototype.slice.call(arguments); | ||
// if the last argument is a function, we're working with callbacks | ||
if (type.function(args[args.length -1])) { | ||
method.apply(this, args); | ||
} | ||
else { | ||
return new Promise(function(resolve, reject) { | ||
args.push(function(err, arg) { | ||
if (err) reject(err); | ||
else resolve(arg); | ||
}); | ||
method.apply(this, args); | ||
}.bind(this)); | ||
} | ||
method(...args); | ||
}); | ||
} | ||
} | ||
}(); | ||
} |
{ | ||
"name" : "async-method" | ||
, "description" : "Makes async methods work with callbacks and promises" | ||
, "version" : "0.1.1" | ||
, "homepage" : "https://github.com/eventEmitter/async-method" | ||
, "author" : "Michael van der Weg <michael@joinbox.com> (http://joinbox.com/)" | ||
, "licence" : "mit" | ||
, "repository": { | ||
"url" : "https://github.com/eventEmitter/async-method.git" | ||
, "type" : "git" | ||
"name": "async-method", | ||
"description": "Makes async methods work with callbacks and promises", | ||
"version": "1.0.0", | ||
"homepage": "https://github.com/eventEmitter/async-method", | ||
"author": "Michael van der Weg <michael@joinbox.com> (http://joinbox.com/)", | ||
"licence": "mit", | ||
"repository": { | ||
"url": "https://github.com/eventEmitter/async-method.git", | ||
"type": "git" | ||
}, | ||
"engines": { | ||
"node": ">=v8" | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/eventEmitter/async-method/issues" | ||
}, | ||
"dependencies": { | ||
"ee-types": "2.1.4", | ||
"ee-log": "3.0.6" | ||
}, | ||
"devDependencies": { | ||
"mocha": "5.x" | ||
}, | ||
"optionalDependencies": {}, | ||
"keywords": [ | ||
"async", | ||
"methods" | ||
], | ||
"scripts": { | ||
"test": "./node_modules/mocha/bin/mocha --reporter spec" | ||
} | ||
, "engines": { | ||
"node" : ">=v0.10.17" | ||
} | ||
, "bugs": { | ||
"url" : "https://github.com/eventEmitter/async-method/issues" | ||
} | ||
, "dependencies": { | ||
"ee-class" : "1.0.x" | ||
, "es6-promise" : "1.0.x" | ||
, "ee-types" : "0.1.x" | ||
, "ee-log" : "0.3.x" | ||
} | ||
, "devDependencies": { | ||
"mocha" : "1.17.x" | ||
} | ||
, "optionalDependencies": {} | ||
, "keywords" : ["async", "methods"] | ||
, "scripts": { | ||
"test" : "./node_modules/mocha/bin/mocha --reporter spec" | ||
} | ||
} | ||
} |
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
2
0
4266
7
46
+ Added@distributed-systems/callsite@1.1.1(transitive)
+ Addedansi-regex@2.1.1(transitive)
+ Addedansi-styles@2.2.13.2.1(transitive)
+ Addedapp-root-path@2.2.1(transitive)
+ Addedbalanced-match@1.0.2(transitive)
+ Addedbrace-expansion@1.1.11(transitive)
+ Addedchalk@1.1.32.4.2(transitive)
+ Addedcolor-convert@1.9.3(transitive)
+ Addedcolor-name@1.1.3(transitive)
+ Addedconcat-map@0.0.1(transitive)
+ Addedee-log@1.1.03.0.6(transitive)
+ Addedee-types@2.1.4(transitive)
+ Addedescape-string-regexp@1.0.5(transitive)
+ Addedfs.realpath@1.0.0(transitive)
+ Addedglob@7.2.3(transitive)
+ Addedhas-ansi@2.0.0(transitive)
+ Addedhas-flag@3.0.0(transitive)
+ Addedinflight@1.0.6(transitive)
+ Addedinherits@2.0.4(transitive)
+ Addedlogd-console-output@1.3.0(transitive)
+ Addedminimatch@3.1.2(transitive)
+ Addedonce@1.4.0(transitive)
+ Addedpath-is-absolute@1.0.1(transitive)
+ Addedsection-tests@1.3.1(transitive)
+ Addedstrip-ansi@3.0.1(transitive)
+ Addedsupports-color@2.0.05.5.0(transitive)
+ Addedwrappy@1.0.2(transitive)
- Removedee-class@1.0.x
- Removedes6-promise@1.0.x
- Removedee-argv@0.1.4(transitive)
- Removedee-class@1.0.9(transitive)
- Removedee-log@0.3.11(transitive)
- Removedee-types@0.1.3(transitive)
- Removedes6-promise@1.0.0(transitive)
Updatedee-log@3.0.6
Updatedee-types@2.1.4