|
|
|
|
|
|
|
|
|
|
|
|
|
'use strict' |
|
|
|
|
|
|
|
|
|
|
|
|
|
module.exports = depd |
|
|
|
|
|
|
|
|
|
|
|
function depd (namespace) { |
|
if (!namespace) { |
|
throw new TypeError('argument namespace is required') |
|
} |
|
|
|
function deprecate (message) { |
|
|
|
} |
|
|
|
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 |
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function wrapfunction (fn, message) { |
|
if (typeof fn !== 'function') { |
|
throw new TypeError('argument fn must be a function') |
|
} |
|
|
|
return fn |
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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') |
|
} |
|
} |
|
|