Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ECMAScript 12 supported code for Syntax Editor Macros #166

Closed

Conversation

dvn-lazywinner
Copy link
Contributor

This pull request includes updates to Syntax Editor Macros, refactored using ECMAScript 12 to support modern JavaScript functionality and improved code clarity. Key updates include:

Modern ECMAScript Syntax: Updated macros to leverage ECMAScript 12 features like optional chaining (?.), nullish coalescing (??), and logical assignment operators, resulting in more readable and efficient code.
Improved Maintainability: Replaced legacy JavaScript patterns with modern syntax, reducing code complexity and enhancing maintainability.
Compatibility and Consistency: Ensured macros are consistent with ECMAScript 12 standards, aligning with best practices for more reliable cross-environment support.
Testing & Validation
Manual Testing: Verified all macros in development and staging environments, ensuring full compatibility with ECMAScript 12 and existing functionality.
Code Review: Conducted peer review to validate syntax and functionality consistency across all updated macros.

Additional Notes
This update helps future-proof the macros, supporting ongoing improvements and compatibility with modern JavaScript standards.

@SapphicFire SapphicFire self-assigned this Oct 30, 2024
Copy link

@SapphicFire SapphicFire left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your submission. However, this pull request requires additional changes before it can be merged. It has several items that do not work in macros and server-side script, and includes a code snippet. Please complete your contribution by changing the necessary elements and resubmit or update this pull request for further review. Closing this for now. Once you make additional changes, feel free to re-open this Pull Request or create a new one.

ga.query();

if (ga.next?.()) {
console.log(ga.getAggregate('COUNT') ?? 0);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

console.log does not resolve server-side

gr.query();

while (gr.next?.()) {
console.log(`Incident ${gr.number} was updated within the last 30 days.`);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

console.log does not resolve server-side

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a code snippet, not a macro

@@ -0,0 +1,15 @@
// Retrieve related records from another table and process them
let parentGR = new GlideRecord('$parent_table');

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The $ format only applies with integers, this does not work as is

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants