Skip to content

Commit

Permalink
Add es3 globals (#267)
Browse files Browse the repository at this point in the history
  • Loading branch information
fisker authored Oct 9, 2024
1 parent 7560717 commit 6784dc1
Show file tree
Hide file tree
Showing 4 changed files with 73 additions and 33 deletions.
32 changes: 32 additions & 0 deletions data/es3.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
export default {
Array: false,
Boolean: false,
Date: false,
decodeURI: false,
decodeURIComponent: false,
encodeURI: false,
encodeURIComponent: false,
Error: false,
escape: false,
eval: false,
EvalError: false,
Function: false,
Infinity: false,
isFinite: false,
isNaN: false,
Math: false,
NaN: false,
Number: false,
Object: false,
parseFloat: false,
parseInt: false,
RangeError: false,
ReferenceError: false,
RegExp: false,
String: false,
SyntaxError: false,
TypeError: false,
undefined: false,
unescape: false,
URIError: false,
};
37 changes: 5 additions & 32 deletions data/es5.mjs
Original file line number Diff line number Diff line change
@@ -1,33 +1,6 @@
export default {
Array: false,
Boolean: false,
Date: false,
decodeURI: false,
decodeURIComponent: false,
encodeURI: false,
encodeURIComponent: false,
Error: false,
escape: false,
eval: false,
EvalError: false,
Function: false,
Infinity: false,
isFinite: false,
isNaN: false,
import {mergeGlobals} from '../utilities.mjs';
import es3Globals from './es3.mjs';

export default mergeGlobals(es3Globals, {
JSON: false,
Math: false,
NaN: false,
Number: false,
Object: false,
parseFloat: false,
parseInt: false,
RangeError: false,
ReferenceError: false,
RegExp: false,
String: false,
SyntaxError: false,
TypeError: false,
undefined: false,
unescape: false,
URIError: false,
};
});
32 changes: 32 additions & 0 deletions globals.json
Original file line number Diff line number Diff line change
Expand Up @@ -1925,6 +1925,38 @@
"WeakRef": false,
"WeakSet": false
},
"es3": {
"Array": false,
"Boolean": false,
"Date": false,
"decodeURI": false,
"decodeURIComponent": false,
"encodeURI": false,
"encodeURIComponent": false,
"Error": false,
"escape": false,
"eval": false,
"EvalError": false,
"Function": false,
"Infinity": false,
"isFinite": false,
"isNaN": false,
"Math": false,
"NaN": false,
"Number": false,
"Object": false,
"parseFloat": false,
"parseInt": false,
"RangeError": false,
"ReferenceError": false,
"RegExp": false,
"String": false,
"SyntaxError": false,
"TypeError": false,
"undefined": false,
"unescape": false,
"URIError": false
},
"es5": {
"Array": false,
"Boolean": false,
Expand Down
5 changes: 4 additions & 1 deletion test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,10 @@ test('should not contain builtins', t => {
test('es versions', t => {
const builtins = new Map(Object.entries(globals.builtin));

const esVersions = ['es5', ...Array.from({length: 2024 - 2015 + 1}, (_, index) => `es${2015 + index}`)];
const esVersions = Object.keys(globals)
.filter(key => /^es(?:3|5|\d{4})$/.test(key))
.sort((versionA, versionB) => Number(versionA.slice(2)) - Number(versionB.slice(2)));

let previousVersion;

for (const esVersion of esVersions) {
Expand Down

0 comments on commit 6784dc1

Please sign in to comment.