agsamantha/node_modules/jintr/dist/nodes/ObjectExpression.js

16 lines
492 B
JavaScript
Raw Normal View History

2024-10-02 20:15:21 +00:00
import BaseJSNode from './BaseJSNode.js';
export default class ObjectExpression extends BaseJSNode {
run() {
let result = {};
for (const prop of this.node.properties) {
if (prop.type === 'Property') {
result = Object.assign(Object.assign({}, result), this.visitor.visitNode(prop));
}
else {
throw new Error(`Unhandled property type: ${prop.type}`);
}
}
return result;
}
}