mirror of
https://github.com/hanzoai/babel.git
synced 2026-09-24 16:56:45 +00:00
16 lines
332 B
JavaScript
16 lines
332 B
JavaScript
var _this = this;
|
|
var fooCalls = [];
|
|
var _jumpTable = function jumpTable(name, arg) {
|
|
babelHelpers.newArrowCheck(this, _this);
|
|
if (_jumpTable[name]) {
|
|
_jumpTable[name](arg);
|
|
}
|
|
}.bind(this);
|
|
Object.assign(_jumpTable, {
|
|
foo(arg) {
|
|
fooCalls.push(arg);
|
|
}
|
|
});
|
|
_jumpTable('foo', 'bar');
|
|
expect(fooCalls[0]).toBe('bar');
|