UNPKG

kuzzle-sdk

Version:
29 lines 978 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Deprecation = void 0; class Deprecation { constructor(deprecationWarning) { this.deprecationWarning = process.env.NODE_ENV !== "production" ? deprecationWarning : false; } /** * Warn the developer that he is using a deprecated action (disabled if NODE_ENV=production) * * @param response Result of a query to the API * * @returns Same as response param, just like a middleware */ logDeprecation(response) { if (this.deprecationWarning && response.deprecations && response.deprecations.length) { for (const deprecation of response.deprecations) { // eslint-disable-next-line no-console console.warn(deprecation.message); } } return response; } } exports.Deprecation = Deprecation; //# sourceMappingURL=Deprecation.js.map