MCPcopy Create free account
hub / github.com/TruthHun/BookStack / deprecate

Function deprecate

static/word2md/mammoth.browser.js:29433–29454  ·  view source on GitHub ↗

* Mark that a method should not be used. * Returns a modified function which warns once by default. * * If `localStorage.noDeprecation = true` is set, then it is a no-op. * * If `localStorage.throwDeprecation = true` is set, then deprecated functions * will throw an Error when invoked. * * I

(fn, msg)

Source from the content-addressed store, hash-verified

29431 */
29432
29433function deprecate (fn, msg) {
29434 if (config('noDeprecation')) {
29435 return fn;
29436 }
29437
29438 var warned = false;
29439 function deprecated() {
29440 if (!warned) {
29441 if (config('throwDeprecation')) {
29442 throw new Error(msg);
29443 } else if (config('traceDeprecation')) {
29444 console.trace(msg);
29445 } else {
29446 console.warn(msg);
29447 }
29448 warned = true;
29449 }
29450 return fn.apply(this, arguments);
29451 }
29452
29453 return deprecated;
29454}
29455
29456/**
29457 * Checks `localStorage` for boolean values for the given `name`.

Callers

nothing calls this directly

Calls 1

configFunction · 0.70

Tested by

no test coverage detected