@google-cloud/promisify
Advanced tools
Comparing version 0.3.0 to 0.3.1
@@ -31,9 +31,9 @@ "use strict"; | ||
options = options || {}; | ||
var slice = Array.prototype.slice; | ||
const slice = Array.prototype.slice; | ||
// tslint:disable-next-line:no-any | ||
var wrapper = function () { | ||
var context = this; | ||
var last; | ||
const wrapper = function () { | ||
const context = this; | ||
let last; | ||
for (last = arguments.length - 1; last >= 0; last--) { | ||
var arg = arguments[last]; | ||
const arg = arguments[last]; | ||
if (typeof arg === 'undefined') { | ||
@@ -48,5 +48,5 @@ continue; // skip trailing undefined. | ||
// peel trailing undefined. | ||
var args = slice.call(arguments, 0, last + 1); | ||
const args = slice.call(arguments, 0, last + 1); | ||
// tslint:disable-next-line:variable-name | ||
var PromiseCtor = Promise; | ||
let PromiseCtor = Promise; | ||
// Because dedupe will likely create a single install of | ||
@@ -58,11 +58,7 @@ // @google-cloud/common to be shared amongst all modules, we need to | ||
} | ||
return new PromiseCtor(function (resolve, reject) { | ||
return new PromiseCtor((resolve, reject) => { | ||
// tslint:disable-next-line:no-any | ||
args.push(function () { | ||
var args = []; | ||
for (var _i = 0; _i < arguments.length; _i++) { | ||
args[_i] = arguments[_i]; | ||
} | ||
var callbackArgs = slice.call(args); | ||
var err = callbackArgs.shift(); | ||
args.push((...args) => { | ||
const callbackArgs = slice.call(args); | ||
const err = callbackArgs.shift(); | ||
if (err) { | ||
@@ -94,5 +90,5 @@ return reject(err); | ||
function promisifyAll(Class, options) { | ||
var exclude = (options && options.exclude) || []; | ||
var ownPropertyNames = Object.getOwnPropertyNames(Class.prototype); | ||
var methods = ownPropertyNames.filter(function (methodName) { | ||
const exclude = (options && options.exclude) || []; | ||
const ownPropertyNames = Object.getOwnPropertyNames(Class.prototype); | ||
const methods = ownPropertyNames.filter((methodName) => { | ||
// clang-format off | ||
@@ -104,4 +100,4 @@ return (typeof Class.prototype[methodName] === 'function' && // is it a function? | ||
}); | ||
methods.forEach(function (methodName) { | ||
var originalMethod = Class.prototype[methodName]; | ||
methods.forEach((methodName) => { | ||
const originalMethod = Class.prototype[methodName]; | ||
if (!originalMethod.promisified_) { | ||
@@ -108,0 +104,0 @@ Class.prototype[methodName] = exports.promisify(originalMethod, options); |
{ | ||
"name": "@google-cloud/promisify", | ||
"version": "0.3.0", | ||
"version": "0.3.1", | ||
"description": "A simple utility for promisifying functions and classes.", | ||
"main": "build/src/index.js", | ||
"types": "build/src/index.d.ts", | ||
"repository": "googleapis/nodejs-promisify", | ||
"scripts": { | ||
@@ -11,3 +12,3 @@ "test": "npm run test-only", | ||
"codecov": "nyc report --reporter=json && codecov -f coverage/*.json", | ||
"check": "gts check", | ||
"lint": "gts check", | ||
"clean": "gts clean", | ||
@@ -18,3 +19,7 @@ "compile": "tsc -p .", | ||
"pretest": "npm run compile", | ||
"posttest": "npm run check" | ||
"posttest": "npm run lint", | ||
"docs": "echo no docs 👻", | ||
"presystem-test": "npm run compile", | ||
"samples-test": "cd samples/ && npm link ../ && npm test && cd ../", | ||
"system-test": "mocha build/system-test" | ||
}, | ||
@@ -32,9 +37,10 @@ "keywords": [], | ||
"codecov": "^3.0.4", | ||
"gts": "^0.7.1", | ||
"gts": "^0.8.0", | ||
"hard-rejection": "^1.0.0", | ||
"intelli-espower-loader": "^1.0.1", | ||
"mocha": "^5.2.0", | ||
"nyc": "^12.0.2", | ||
"nyc": "^13.0.0", | ||
"sinon": "^6.1.3", | ||
"source-map-support": "^0.5.6", | ||
"typescript": "^2.9.0" | ||
"typescript": "^3.0.0" | ||
}, | ||
@@ -41,0 +47,0 @@ "nyc": { |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
23224
7
0
12
153