Skip to content

Conversation

@yadavsaroj
Copy link
Contributor

No description provided.

Copy link
Collaborator

Choose a reason for hiding this comment

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

You could use Em.compare to compare the two arrays (guarded by an isArray). There's also isEqual, which doesn't seem to work for arrays afaict.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I am not comparing the actual contents of an array, all I am checking is if they both are empty. Em.compare though can be used, seems to be an overkill for that.

btw just checked if Em.compare looks into actual array contents, unless I am missing something does not look like that as
Em.compare([{k1:1}], [{k1:111}]) returns 0, the value it returns if both objects being compared are equal.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Ah, yeah compare can't be used here. So this is meant to support just empty arrays and scalars? (i.e it will skip arrays with values and objects)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes! It won't compare non empty arrays.

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