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

Added toArray() helper to cast any value to an array #8449

Merged
merged 5 commits into from
Nov 20, 2020
Merged

Added toArray() helper to cast any value to an array #8449

merged 5 commits into from
Nov 20, 2020

Conversation

psmyrek
Copy link
Contributor

@psmyrek psmyrek commented Nov 12, 2020

Suggested merge commit message (convention)

Internal: Added toArray() helper to cast any value to an array. Closes #7401.


Additional information

All occurrences of Array.isArray( value ) ? value : [ value ] and [].concat( value ) have been replaced by this new toArray( value ) helper.

@mlewand mlewand self-requested a review November 16, 2020 09:05
@jodator jodator self-assigned this Nov 16, 2020
Copy link
Contributor

@jodator jodator left a comment

Choose a reason for hiding this comment

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

Nice catch with all the variants of this check, especially [].concat() one :)

I do have one question about the need for the default value though.

packages/ckeditor5-utils/src/toarray.js Outdated Show resolved Hide resolved
packages/ckeditor5-utils/src/toarray.js Outdated Show resolved Hide resolved
@jodator jodator self-requested a review November 20, 2020 06:54
Copy link
Contributor

@jodator jodator left a comment

Choose a reason for hiding this comment

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

LGTM 👍

@jodator jodator merged commit e92068a into master Nov 20, 2020
@jodator jodator deleted the i/7401 branch November 20, 2020 06:55
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.

Create a helper that normalizes a value to an array (if not already an array)
2 participants