@google-cloud/promisify
Advanced tools
Comparing version 1.0.4 to 2.0.0
"use strict"; | ||
// Copyright 2014 Google LLC | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
/* eslint-disable prefer-rest-params */ | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -32,3 +20,2 @@ /** | ||
const wrapper = function () { | ||
const context = this; | ||
let last; | ||
@@ -43,3 +30,3 @@ for (last = arguments.length - 1; last >= 0; last--) { | ||
} | ||
return originalMethod.apply(context, arguments); | ||
return originalMethod.apply(this, arguments); | ||
} | ||
@@ -53,4 +40,4 @@ // peel trailing undefined. | ||
// localize it at the Service level. | ||
if (context && context.Promise) { | ||
PromiseCtor = context.Promise; | ||
if (this && this.Promise) { | ||
PromiseCtor = this.Promise; | ||
} | ||
@@ -72,3 +59,3 @@ return new PromiseCtor((resolve, reject) => { | ||
}); | ||
originalMethod.apply(context, args); | ||
originalMethod.apply(this, args); | ||
}); | ||
@@ -120,8 +107,7 @@ }; | ||
const wrapper = function () { | ||
const context = this; | ||
if (typeof arguments[arguments.length - 1] !== 'function') { | ||
return originalMethod.apply(context, arguments); | ||
return originalMethod.apply(this, arguments); | ||
} | ||
const cb = Array.prototype.pop.call(arguments); | ||
originalMethod.apply(context, arguments).then( | ||
originalMethod.apply(this, arguments).then( | ||
// tslint:disable-next-line:no-any | ||
@@ -128,0 +114,0 @@ (res) => { |
@@ -7,2 +7,19 @@ # Changelog | ||
## [2.0.0](https://www.github.com/googleapis/nodejs-promisify/compare/v1.0.4...v2.0.0) (2020-03-23) | ||
### ⚠ BREAKING CHANGES | ||
* update to latest version of gts/typescript (#183) | ||
* drop Node 8 from engines field (#184) | ||
### Features | ||
* drop Node 8 from engines field ([#184](https://www.github.com/googleapis/nodejs-promisify/issues/184)) ([7e6d3c5](https://www.github.com/googleapis/nodejs-promisify/commit/7e6d3c54066d89530ed25c7f9722efd252f43fb8)) | ||
### Build System | ||
* update to latest version of gts/typescript ([#183](https://www.github.com/googleapis/nodejs-promisify/issues/183)) ([9c3ed12](https://www.github.com/googleapis/nodejs-promisify/commit/9c3ed12c12f4bb1e17af7440c6371c4cefddcd59)) | ||
### [1.0.4](https://www.github.com/googleapis/nodejs-promisify/compare/v1.0.3...v1.0.4) (2019-12-05) | ||
@@ -9,0 +26,0 @@ |
{ | ||
"name": "@google-cloud/promisify", | ||
"version": "1.0.4", | ||
"version": "2.0.0", | ||
"description": "A simple utility for promisifying functions and classes.", | ||
@@ -9,5 +9,4 @@ "main": "build/src/index.js", | ||
"scripts": { | ||
"test": "nyc mocha build/test", | ||
"test": "c8 mocha build/test", | ||
"lint": "gts check", | ||
"clean": "gts clean", | ||
"compile": "tsc -p .", | ||
@@ -17,3 +16,2 @@ "fix": "gts fix", | ||
"pretest": "npm run compile", | ||
"posttest": "npm run lint", | ||
"docs": "compodoc src/", | ||
@@ -24,3 +22,4 @@ "presystem-test": "npm run compile", | ||
"docs-test": "linkinator docs", | ||
"predocs-test": "npm run docs" | ||
"predocs-test": "npm run docs", | ||
"prelint": "cd samples; npm link ../; npm i" | ||
}, | ||
@@ -36,19 +35,18 @@ "keywords": [], | ||
"@compodoc/compodoc": "^1.1.9", | ||
"@types/mocha": "^5.2.4", | ||
"@types/mocha": "^7.0.0", | ||
"@types/node": "^10.5.2", | ||
"@types/sinon": "^7.0.0", | ||
"c8": "^7.0.0", | ||
"chai": "^4.2.0", | ||
"codecov": "^3.0.4", | ||
"gts": "^1.0.0", | ||
"hard-rejection": "^2.0.0", | ||
"intelli-espower-loader": "^1.0.1", | ||
"linkinator": "^1.5.0", | ||
"mocha": "^6.0.0", | ||
"nyc": "^14.0.0", | ||
"sinon": "^7.0.0", | ||
"source-map-support": "^0.5.6", | ||
"typescript": "3.6.4" | ||
"gts": "^2.0.0-alpha.5", | ||
"hard-rejection": "^2.1.0", | ||
"linkinator": "^2.0.0", | ||
"mocha": "^7.1.1", | ||
"sinon": "^9.0.0", | ||
"typescript": "^3.8.3" | ||
}, | ||
"engines": { | ||
"node": ">=8.10.0" | ||
"node": ">=10" | ||
} | ||
} |
@@ -115,2 +115,8 @@ [//]: # "This README.md file is auto-generated, all changes to this file will be lost." | ||
Please note that this `README.md`, the `samples/README.md`, | ||
and a variety of configuration files in this repository (including `.nycrc` and `tsconfig.json`) | ||
are generated from a central template. To edit one of these files, make an edit | ||
to its template in this | ||
[directory](https://github.com/googleapis/synthtool/tree/master/synthtool/gcp/templates/node_library). | ||
## License | ||
@@ -117,0 +123,0 @@ |
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
32842
13
134
205