- 新增GetXToken函数用于生成x-api-eid-token - 实现HASH类用于计算128位哈希值 - 添加md5函数用于消息摘要计算 - 实现STrEnc函数用于字符串加密 - 添加getLastParameter与splitAndJoin辅助函数 - 构建完整的浏览器指纹对象生成逻辑 - 集成node-fetch与https-proxy-agent支持代理请求 - 实现完整的WebGL与浏览器环境模拟数据结构
78 lines
1.5 KiB
JavaScript
78 lines
1.5 KiB
JavaScript
/*!
|
|
* 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')
|
|
}
|
|
}
|