objectionary / eo2js

EOLANG to JavaScript transpiler and runtime
https://www.npmjs.com/package/eo2js
MIT License
7 stars 3 forks source link

Optimizing metadata validation in the hasMeta function #106

Open Akvadevka opened 1 month ago

Akvadevka commented 1 month ago

The logic of checking for the head property in the metas object has been changed to improve readability and eliminate redundant code. The metadata array now uses the 'some' method, and for objects with head, a secure check with the ?. operator is used, which allows to get rid of the intermediate variable and reduces the number of conditions.


PR-Codex overview

This PR refactors the hasMeta and transform functions in eo2js/src/commands/transpile.js. It simplifies the logic for checking metadata and adds error handling to the transform function.

Detailed summary

✨ Ask PR-Codex anything about this PR by commenting with /codex {your question}