| Server IP : 34.87.99.72 / Your IP : 216.73.217.31 Web Server : Apache/2.4.46 (Unix) OpenSSL/1.1.1n System : Linux zlock-bitnami-lamp-prod-v2-vm 4.19.0-16-cloud-amd64 #1 SMP Debian 4.19.181-1 (2021-03-19) x86_64 User : bitnami ( 1000) PHP Version : 7.4.18 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : OFF Directory : /opt/bitnami/nami/node_modules/node-environment-flags/ |
Upload File : |
'use strict';
const semver = require('semver');
const flags = require('./flags.json');
const getDescriptors = require('object.getownpropertydescriptors');
const replaceUnderscoresRegex = /_/g;
const leadingDashesRegex = /^--?/;
const trailingValuesRegex = /=.*$/;
const replace = Function.call.bind(String.prototype.replace);
const has = Function.call.bind(Set.prototype.has);
const test = Function.call.bind(RegExp.prototype.test);
const [allowedNodeEnvironmentFlags, detectedSemverRange] = Object.keys(
flags
).reduce(
(acc, range) =>
acc ||
(semver.satisfies(process.version, range) ? [flags[range], range] : acc),
null
);
const trimLeadingDashes = flag => replace(flag, leadingDashesRegex, '');
class NodeEnvironmentFlagsSet extends Set {
constructor(...args) {
super(...args);
this.add = () => this;
}
delete() {
return false;
}
clear() {}
has(key) {
if (typeof key === 'string') {
key = replace(key, replaceUnderscoresRegex, '-');
if (test(leadingDashesRegex, key)) {
key = replace(key, trailingValuesRegex, '');
return has(this, key);
}
return has(nodeFlags, key);
}
return false;
}
}
const nodeFlags = Object.defineProperties(
new Set(allowedNodeEnvironmentFlags.map(trimLeadingDashes)),
getDescriptors(Set.prototype)
);
Object.freeze(NodeEnvironmentFlagsSet.prototype.constructor);
Object.freeze(NodeEnvironmentFlagsSet.prototype);
exports.allowedNodeEnvironmentFlags = Object.freeze(
new NodeEnvironmentFlagsSet(allowedNodeEnvironmentFlags)
);
exports.detectedSemverRange = detectedSemverRange;