保誠-保戶業務員媒合平台
HelenHuang
2022-06-09 9bdb95c9e34cef640534e5e5a1e2225a80442000
PAMapp/node_modules/depd/index.js
@@ -1,6 +1,6 @@
/*!
 * depd
 * Copyright(c) 2014-2017 Douglas Christopher Wilson
 * Copyright(c) 2014-2018 Douglas Christopher Wilson
 * MIT Licensed
 */
@@ -8,8 +8,6 @@
 * Module dependencies.
 */
var callSiteToString = require('./lib/compat').callSiteToString
var eventListenerCount = require('./lib/compat').eventListenerCount
var relative = require('path').relative
/**
@@ -92,7 +90,7 @@
  }
  for (var i = 0; i < stack.length; i++) {
    str += '\n    at ' + callSiteToString(stack[i])
    str += '\n    at ' + stack[i].toString()
  }
  return str
@@ -129,11 +127,30 @@
}
/**
 * Determine if event emitter has listeners of a given type.
 *
 * The way to do this check is done three different ways in Node.js >= 0.8
 * so this consolidates them into a minimal set using instance methods.
 *
 * @param {EventEmitter} emitter
 * @param {string} type
 * @returns {boolean}
 * @private
 */
function eehaslisteners (emitter, type) {
  var count = typeof emitter.listenerCount !== 'function'
    ? emitter.listeners(type).length
    : emitter.listenerCount(type)
  return count > 0
}
/**
 * Determine if namespace is ignored.
 */
function isignored (namespace) {
  /* istanbul ignore next: tested in a child processs */
  if (process.noDeprecation) {
    // --no-deprecation support
    return true
@@ -150,7 +167,6 @@
 */
function istraced (namespace) {
  /* istanbul ignore next: tested in a child processs */
  if (process.traceDeprecation) {
    // --trace-deprecation support
    return true
@@ -167,7 +183,7 @@
 */
function log (message, site) {
  var haslisteners = eventListenerCount(process, 'deprecation') !== 0
  var haslisteners = eehaslisteners(process, 'deprecation')
  // abort early if no destination
  if (!haslisteners && this._ignored) {
@@ -310,7 +326,7 @@
  // add stack trace
  if (this._traced) {
    for (var i = 0; i < stack.length; i++) {
      formatted += '\n    at ' + callSiteToString(stack[i])
      formatted += '\n    at ' + stack[i].toString()
    }
    return formatted
@@ -335,7 +351,7 @@
  // add stack trace
  if (this._traced) {
    for (var i = 0; i < stack.length; i++) {
      formatted += '\n    \x1b[36mat ' + callSiteToString(stack[i]) + '\x1b[39m' // cyan
      formatted += '\n    \x1b[36mat ' + stack[i].toString() + '\x1b[39m' // cyan
    }
    return formatted
@@ -400,18 +416,18 @@
  }
  var args = createArgumentsString(fn.length)
  var deprecate = this // eslint-disable-line no-unused-vars
  var stack = getStack()
  var site = callSiteLocation(stack[1])
  site.name = fn.name
   // eslint-disable-next-line no-eval
  var deprecatedfn = eval('(function (' + args + ') {\n' +
  // eslint-disable-next-line no-new-func
  var deprecatedfn = new Function('fn', 'log', 'deprecate', 'message', 'site',
    '"use strict"\n' +
    'return function (' + args + ') {' +
    'log.call(deprecate, message, site)\n' +
    'return fn.apply(this, arguments)\n' +
    '})')
    '}')(fn, log, this, message, site)
  return deprecatedfn
}