Sha256: 10b4d4a4e9d14e9e6a5ab7ced64405ef90e6bec94d479a8e223cbba88828ad79

Contents?: true

Size: 1.48 KB

Versions: 44

Compression:

Stored size: 1.48 KB

Contents

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

'use strict'

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

module.exports = depd

/**
 * Create deprecate for namespace in caller.
 */

function depd (namespace) {
  if (!namespace) {
    throw new TypeError('argument namespace is required')
  }

  function deprecate (message) {
    // no-op in browser
  }

  deprecate._file = undefined
  deprecate._ignored = true
  deprecate._namespace = namespace
  deprecate._traced = false
  deprecate._warned = Object.create(null)

  deprecate.function = wrapfunction
  deprecate.property = wrapproperty

  return deprecate
}

/**
 * Return a wrapped function in a deprecation message.
 *
 * This is a no-op version of the wrapper, which does nothing but call
 * validation.
 */

function wrapfunction (fn, message) {
  if (typeof fn !== 'function') {
    throw new TypeError('argument fn must be a function')
  }

  return fn
}

/**
 * Wrap property in a deprecation message.
 *
 * This is a no-op version of the wrapper, which does nothing but call
 * validation.
 */

function wrapproperty (obj, prop, message) {
  if (!obj || (typeof obj !== 'object' && typeof obj !== 'function')) {
    throw new TypeError('argument obj must be object')
  }

  var descriptor = Object.getOwnPropertyDescriptor(obj, prop)

  if (!descriptor) {
    throw new TypeError('must call property on owner object')
  }

  if (!descriptor.configurable) {
    throw new TypeError('property must be configurable')
  }
}

Version data entries

44 entries across 36 versions & 13 rubygems

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