-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
322 changed files
with
14,088 additions
and
962 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# https://github.com/crate-ci/typos | ||
# cargo install typos-cli | ||
# typos | ||
|
||
[files] | ||
extend-exclude = [ | ||
"data.json", | ||
"src/meta/*.rs", | ||
] |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,70 @@ | ||
const es2016 = require('./compat-table/data-es2016plus.js'); | ||
const es5 = require('./compat-table/data-es5.js').tests.map((t) => ({ | ||
target: 'es5', | ||
...t, | ||
})); | ||
const es6 = require('./compat-table/data-es6.js').tests.map((t) => ({ | ||
target: 'es6', | ||
...t, | ||
})); | ||
const es2016Plus = require('./compat-table/data-es2016plus.js').tests.map((t) => ({ | ||
target: 'es2016', | ||
...t, | ||
})); | ||
const esnext = require('./compat-table/data-esnext.js').tests.map((t) => ({ | ||
target: 'esnext', | ||
...t, | ||
})); | ||
|
||
const data = es2016.tests.map((test) => { | ||
const data = es5.concat(es6, es2016Plus, esnext).map((test) => { | ||
return mapper(test); | ||
}); | ||
|
||
console.log(JSON.stringify(data, null, 2)); | ||
|
||
function mapper(test) { | ||
return { | ||
name: test.name, | ||
target: test.target, | ||
category: test.category, | ||
significance: test.significance, | ||
spec: test.spec, | ||
mdn: test.mdn, | ||
exec: test.exec && testScript(test.exec).trim(), | ||
subtests: test.subtests && test.subtests.map(mapper), | ||
}; | ||
}); | ||
} | ||
|
||
console.log(JSON.stringify(data, null, 2)); | ||
function testScript(fn) { | ||
function deindentFunc(fn) { | ||
fn = fn + ''; | ||
var indent = /(?:^|\n)([\t ]+)[^\n]+/.exec(fn); | ||
if (indent) { | ||
fn = fn.replace(new RegExp('\n' + indent[1], 'g'), '\n'); | ||
} | ||
return fn; | ||
} | ||
if (!fn) { | ||
return ''; | ||
} | ||
if (typeof fn === 'function') { | ||
// see if the code is encoded in a comment | ||
var expr = (fn + '').match(/[^]*\/\*([^]*)\*\/\}$/); | ||
// if there wasn't an expression, make the function statement into one | ||
if (!expr) { | ||
expr = deindentFunc(fn); | ||
return expr; | ||
} else { | ||
expr = deindentFunc(expr[1]); | ||
return expr; | ||
} | ||
} else { | ||
// it's an array of objects like the following: | ||
// { type: 'application/javascript;version=1.8', script: function () { ... } } | ||
return fn.reduce(function(text, script) { | ||
var expr = deindentFunc( | ||
(script.script + '').replace(/^function \(\) \{\s*|\s*\}$/g, ''), | ||
); | ||
return text + '\n' + expr; | ||
}, ''); | ||
} | ||
} |
Oops, something went wrong.