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] (#361) Add Object support in Array.from() method #362

Merged
merged 4 commits into from
Aug 1, 2024

Conversation

akantchev
Copy link
Contributor

@akantchev akantchev commented Jul 29, 2024

Description

Add support of objects in the VROES.Shims.arrayFrom() method so its behavior is similar to the standard Array.from() method.

Checklist

  • I have added necessary documentation, relevant usage information (if applicable)
  • I have updated the PR title with affected component, related issue number and a short summary of the changes introduced
  • I have added labels for implementation kind (kind/) and version type (version/)
  • I have tested against live environment, if applicable
  • I have my changes rebased and squashed to the minimal number of relevant commits. Notice: don't squash all commits
  • I have added a descriptive commit message with a short title, including a Fixed #XXX - or Closed #XXX - prefix to auto-close the issue

Testing

  1. Create a workflow with one script able task that has the following code:
var __global = System.getContext() || (function () { return this; }).call(null);
var VROES = __global.__VROES || (__global.__VROES = System.getModule("com.vmware.pscoe.library.ecmascript").VROES()), exports = {};

var array1 = array1 = VROES.Shims.arrayFrom({ length: 5 });
System.log("Array 1  data: " + JSON.stringify(array1, null, 4));

var arr = [{ key1: 1 }, { key2: 2 }, 3, "ddd"];
var array2 = VROES.Shims.arrayFrom(arr);
System.log("Array 2  data: " + JSON.stringify(array2, null, 4));
  1. Run the workflow, the output should be array based on the input object.

Test Screenshot

361_array_test_results

Release Notes

Add support of objects in the VROES.Shims.arrayFrom() method so its behavior is similar to the standard Array,from() method.

Related issues and PRs

Resolves #361

…in order to be compatible with Array.from()

Signed-off-by: Alexander Kantchev <akantchev@vmware.com>
@akantchev akantchev requested a review from a team as a code owner July 29, 2024 12:45
@github-actions github-actions bot added kind/bug Something isn't working kind/enhancement Enhancement or improvement of existing features labels Jul 29, 2024
@akantchev akantchev added the area/ecmascript Relates to ecmascript module label Jul 29, 2024
@VenelinBakalov VenelinBakalov changed the title Issue #361 Add Object Support in the VROES.Shims.arrayFrom() [ecmascript] (#361) Add Object Support in the VROES.Shims.arrayFrom() Jul 29, 2024
Copy link
Contributor

@Indy-rbo Indy-rbo left a comment

Choose a reason for hiding this comment

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

This change does not resolve my issue

packages/ecmascript/src/Shims.ts Outdated Show resolved Hide resolved
docs/versions/latest/Release.md Outdated Show resolved Hide resolved
docs/versions/latest/Release.md Outdated Show resolved Hide resolved
docs/versions/latest/Release.md Outdated Show resolved Hide resolved
@VenelinBakalov VenelinBakalov added the version/minor Introduces a non-breaking feature or change label Jul 30, 2024
Copy link
Collaborator

@VenelinBakalov VenelinBakalov left a comment

Choose a reason for hiding this comment

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

Pending review on the documentation changes by @ktsonchev .
In the meantime, @Michaelpalacce and @akantchev please double check if there are any other changes required purely from code perspective and we will align next week.

Signed-off-by: Alexander Kantchev <akantchev@vmware.com>
… for non indexed ones.

Signed-off-by: Alexander Kantchev <akantchev@vmware.com>
Signed-off-by: Alexander Kantchev <akantchev@vmware.com>
@akantchev akantchev self-assigned this Jul 31, 2024
@Indy-rbo
Copy link
Contributor

Thanks everyone! This should now correctly resolve #361

Copy link
Contributor

@Indy-rbo Indy-rbo left a comment

Choose a reason for hiding this comment

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

Sorry something came to mind later regarding honoring the functions return type

packages/ecmascript/src/Shims.ts Show resolved Hide resolved
@akantchev akantchev dismissed Michaelpalacce’s stale review August 1, 2024 06:48

Requested changes were applied

@akantchev akantchev merged commit 51835c7 into main Aug 1, 2024
14 checks passed
@VenelinBakalov VenelinBakalov deleted the bugfix/361-shims-array-from-object-support branch August 1, 2024 08:14
@VenelinBakalov
Copy link
Collaborator

Thanks everyone! This should now correctly resolve #361

thank you for your suggestions and support as well!

@VenelinBakalov VenelinBakalov changed the title [ecmascript] (#361) Add Object Support in the VROES.Shims.arrayFrom() [ecmascript] (#361) Add Object support in Array.from() method Aug 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/ecmascript Relates to ecmascript module kind/bug Something isn't working kind/enhancement Enhancement or improvement of existing features version/minor Introduces a non-breaking feature or change
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Shim for Array.from() doesn't handle Object type
4 participants