PHP WebShell
Текущая директория: /opt/BitGoJS/node_modules/capability/lib
Просмотр файла: CapabilityDetector.js
var CapabilityDetector = function () {
this.tests = {};
this.cache = {};
};
CapabilityDetector.prototype = {
constructor: CapabilityDetector,
define: function (name, test) {
if (typeof (name) != "string" || !(test instanceof Function))
throw new Error("Invalid capability definition.");
if (this.tests[name])
throw new Error('Duplicated capability definition by "' + name + '".');
this.tests[name] = test;
},
check: function (name) {
if (!this.test(name))
throw new Error('The current environment does not support "' + name + '", therefore we cannot continue.');
},
test: function (name) {
if (this.cache[name] !== undefined)
return this.cache[name];
if (!this.tests[name])
throw new Error('Unknown capability with name "' + name + '".');
var test = this.tests[name];
this.cache[name] = !!test();
return this.cache[name];
}
};
module.exports = CapabilityDetector;Выполнить команду
Для локальной разработки. Не используйте в интернете!