Sha256: 76baf83317ac81045cefb9fcc8ec0d8e47dd0cfcbadd592f480349412e161861

Contents?: true

Size: 1.39 KB

Versions: 41

Compression:

Stored size: 1.39 KB

Contents

/*!
 * depd
 * Copyright(c) 2014-2015 Douglas Christopher Wilson
 * MIT Licensed
 */

'use strict'

/**
 * Module dependencies.
 * @private
 */

var EventEmitter = require('events').EventEmitter

/**
 * Module exports.
 * @public
 */

lazyProperty(module.exports, 'callSiteToString', function callSiteToString () {
  var limit = Error.stackTraceLimit
  var obj = {}
  var prep = Error.prepareStackTrace

  function prepareObjectStackTrace (obj, stack) {
    return stack
  }

  Error.prepareStackTrace = prepareObjectStackTrace
  Error.stackTraceLimit = 2

  // capture the stack
  Error.captureStackTrace(obj)

  // slice the stack
  var stack = obj.stack.slice()

  Error.prepareStackTrace = prep
  Error.stackTraceLimit = limit

  return stack[0].toString ? toString : require('./callsite-tostring')
})

lazyProperty(module.exports, 'eventListenerCount', function eventListenerCount () {
  return EventEmitter.listenerCount || require('./event-listener-count')
})

/**
 * Define a lazy property.
 */

function lazyProperty (obj, prop, getter) {
  function get () {
    var val = getter()

    Object.defineProperty(obj, prop, {
      configurable: true,
      enumerable: true,
      value: val
    })

    return val
  }

  Object.defineProperty(obj, prop, {
    configurable: true,
    enumerable: true,
    get: get
  })
}

/**
 * Call toString() on the obj
 */

function toString (obj) {
  return obj.toString()
}

Version data entries

41 entries across 36 versions & 13 rubygems

Version Path
rapid_stack-0.2.0 templates/frontend/node_modules/serve-index/node_modules/depd/lib/compat/index.js
rapid_stack-0.1.1 templates/FrontEnd/node_modules/serve-index/node_modules/depd/lib/compat/index.js
rapid_stack-0.1.0 templates/FrontEnd/node_modules/serve-index/node_modules/depd/lib/compat/index.js
optimacms-0.1.61 spec/dummy/node_modules/depd/lib/compat/index.js
disco_app-0.18.0 test/dummy/node_modules/depd/lib/compat/index.js
disco_app-0.18.2 test/dummy/node_modules/depd/lib/compat/index.js
disco_app-0.16.1 test/dummy/node_modules/depd/lib/compat/index.js
disco_app-0.15.2 test/dummy/node_modules/depd/lib/compat/index.js
disco_app-0.18.4 test/dummy/node_modules/depd/lib/compat/index.js
disco_app-0.18.1 test/dummy/node_modules/depd/lib/compat/index.js
disco_app-0.12.7.pre.puma.pre.3 test/dummy/node_modules/depd/lib/compat/index.js
disco_app-0.14.0 test/dummy/node_modules/depd/lib/compat/index.js
disco_app-0.13.6.pre.puma.pre.3 test/dummy/node_modules/depd/lib/compat/index.js
tang-0.2.1 spec/tang_app/node_modules/depd/lib/compat/index.js
groonga-client-model-6.0.0 test/apps/rails6.0.3.5/node_modules/depd/lib/compat/index.js
groonga-client-model-6.0.0 test/apps/rails6.1.3/node_modules/depd/lib/compat/index.js
ruby2js-4.0.4 lib/tasks/testrails/node_modules/depd/lib/compat/index.js
ruby2js-4.0.3 lib/tasks/testrails/node_modules/depd/lib/compat/index.js
tang-0.2.0 spec/tang_app/node_modules/depd/lib/compat/index.js
tang-0.1.0 spec/tang_app/node_modules/depd/lib/compat/index.js