Vendor things
This commit is contained in:
parent
5deceec006
commit
977e3c17e5
19434 changed files with 10682014 additions and 0 deletions
16
third-party/vendor/wasm-bindgen/tests/wasm/arg_names.js
vendored
Normal file
16
third-party/vendor/wasm-bindgen/tests/wasm/arg_names.js
vendored
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
const wasm = require('wasm-bindgen-test.js');
|
||||
const assert = require('assert');
|
||||
|
||||
const ARGUMENT_NAMES = /([^\s,]+)/g;
|
||||
const STRIP_COMMENTS = /((\/\/.*$)|(\/\*[\s\S]*?\*\/))/mg;
|
||||
|
||||
// https://stackoverflow.com/q/1007981/210304
|
||||
function getArgNames(func) {
|
||||
let fnStr = func.toString().replace(STRIP_COMMENTS, '');
|
||||
let result = fnStr.slice(fnStr.indexOf('(')+1, fnStr.indexOf(')')).match(ARGUMENT_NAMES);
|
||||
return result === null ? [] : result;
|
||||
}
|
||||
|
||||
exports.js_arg_names = () => {
|
||||
assert.deepEqual(getArgNames(wasm.fn_with_many_args), ['_a', '_b', '_c', '_d']);
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue