UNPKG

685 BJavaScriptView Raw
1// Copyright IBM Corp. 2015,2019. All Rights Reserved.
2// Node module: loopback-datasource-juggler
3// This file is licensed under the MIT License.
4// License text available at https://opensource.org/licenses/MIT
5
6'use strict';
7
8// A lightweight alternative to "depd" that works in the browser
9module.exports = function depd(namespace) {
10 const warned = {};
11 return function deprecate(message) {
12 if (warned[message]) return;
13 warned[message] = true;
14
15 if (process.noDeprecation) {
16 return;
17 } else if (process.traceDeprecation) {
18 console.trace(namespace, 'deprecated', message);
19 } else {
20 console.warn(namespace, 'deprecated', message);
21 }
22 };
23};