2021-05-20 07:51:30 +03:00
|
|
|
// Run this script to build jsprops.json
|
|
|
|
|
2022-05-04 17:25:28 +03:00
|
|
|
const fs = require("fs");
|
2021-05-20 07:51:30 +03:00
|
|
|
|
|
|
|
// Compatibility fix for some standard defined globals not defined on every js environment
|
2022-05-04 17:25:28 +03:00
|
|
|
var new_globals = [
|
|
|
|
"Symbol",
|
|
|
|
"Map",
|
|
|
|
"Promise",
|
|
|
|
"Proxy",
|
|
|
|
"Reflect",
|
|
|
|
"Set",
|
|
|
|
"WeakMap",
|
|
|
|
"WeakSet",
|
|
|
|
];
|
2021-05-20 07:51:30 +03:00
|
|
|
var objects = {};
|
|
|
|
var global_ref = typeof global === "object" ? global : self;
|
|
|
|
|
|
|
|
new_globals.forEach(function (new_global) {
|
|
|
|
objects[new_global] = global_ref[new_global] || new Function();
|
|
|
|
});
|
|
|
|
|
|
|
|
const addedProps = new Set();
|
|
|
|
|
2022-05-04 17:25:28 +03:00
|
|
|
const add = (propName) => addedProps.add(propName);
|
2021-05-20 07:51:30 +03:00
|
|
|
|
2022-05-04 17:25:28 +03:00
|
|
|
["null", "true", "false", "NaN", "Infinity", "-Infinity", "undefined"].forEach(
|
|
|
|
add
|
|
|
|
);
|
2021-05-20 07:51:30 +03:00
|
|
|
[
|
2022-05-04 17:25:28 +03:00
|
|
|
Object,
|
|
|
|
Array,
|
|
|
|
Function,
|
|
|
|
Number,
|
|
|
|
String,
|
|
|
|
Boolean,
|
|
|
|
Error,
|
|
|
|
Math,
|
|
|
|
Date,
|
|
|
|
RegExp,
|
|
|
|
objects.Symbol,
|
|
|
|
ArrayBuffer,
|
|
|
|
DataView,
|
|
|
|
decodeURI,
|
|
|
|
decodeURIComponent,
|
|
|
|
encodeURI,
|
|
|
|
encodeURIComponent,
|
|
|
|
eval,
|
|
|
|
EvalError,
|
|
|
|
Float32Array,
|
|
|
|
Float64Array,
|
|
|
|
Int8Array,
|
|
|
|
Int16Array,
|
|
|
|
Int32Array,
|
|
|
|
isFinite,
|
|
|
|
isNaN,
|
|
|
|
JSON,
|
|
|
|
objects.Map,
|
|
|
|
parseFloat,
|
|
|
|
parseInt,
|
|
|
|
objects.Promise,
|
|
|
|
objects.Proxy,
|
|
|
|
RangeError,
|
|
|
|
ReferenceError,
|
|
|
|
objects.Reflect,
|
|
|
|
objects.Set,
|
|
|
|
SyntaxError,
|
|
|
|
TypeError,
|
|
|
|
Uint8Array,
|
|
|
|
Uint8ClampedArray,
|
|
|
|
Uint16Array,
|
|
|
|
Uint32Array,
|
|
|
|
URIError,
|
|
|
|
objects.WeakMap,
|
|
|
|
objects.WeakSet,
|
2021-05-20 07:51:30 +03:00
|
|
|
].forEach((ctor) => {
|
|
|
|
Object.getOwnPropertyNames(ctor).map(add);
|
|
|
|
if (ctor.prototype) {
|
|
|
|
Object.getOwnPropertyNames(ctor.prototype).map(add);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2022-05-04 17:25:28 +03:00
|
|
|
const propsJSON = JSON.stringify([...addedProps].sort(), null, 4);
|
2021-05-20 07:51:30 +03:00
|
|
|
|
2022-05-04 17:25:28 +03:00
|
|
|
fs.writeFileSync(__dirname + "/../src/lists/jsprops.json", propsJSON);
|