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
Modified hasMeta to use Array.prototype.some() for checking metadata presence.
Updated transform function with try-catch for error handling.
Retained existing functionality while improving code clarity and robustness.
✨ Ask PR-Codex anything about this PR by commenting with /codex {your question}
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
andtransform
functions ineo2js/src/commands/transpile.js
. It simplifies the logic for checking metadata and adds error handling to thetransform
function.Detailed summary
hasMeta
to useArray.prototype.some()
for checking metadata presence.transform
function with try-catch for error handling.