Skip to content

Conversation

@LuziferSenpai
Copy link

@LuziferSenpai LuziferSenpai commented Jan 5, 2025

Description

  • Added snippet to split a array into smaller chunks

Type of Change

  • ✨ New snippet
  • πŸ›  Improvement to an existing snippet
  • 🐞 Bug fix
  • πŸ“– Documentation update
  • πŸ”§ Other (please describe):

Checklist

  • I have tested my code and verified it works as expected.
  • My code follows the style and contribution guidelines of this project.
  • Comments are added where necessary for clarity.
  • Documentation has been updated (if applicable).
  • There are no new warnings or errors from my changes.

Related Issues

Closes #

Additional Context

Screenshots (Optional)

Click to view screenshots

@LuziferSenpai LuziferSenpai changed the title add chunkArray function to array manipulation snippets [Snippets] add chunkArray function to array manipulation snippets Jan 5, 2025
Copy link
Collaborator

@Mathys-Gasnier Mathys-Gasnier left a comment

Choose a reason for hiding this comment

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

Looks great

if (!Array.isArray(array)) {
throw new TypeError('Expected an array as the first argument.');
}
if (typeof chunkSize !== 'number' || chunkSize <= 0) {
Copy link
Collaborator

@saminjay saminjay Jan 8, 2025

Choose a reason for hiding this comment

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

You need to specifically check for NaN, its type is number

Copy link
Author

Choose a reason for hiding this comment

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

Okay I updated it to also check for NaN.

Copy link
Collaborator

@majvax majvax left a comment

Choose a reason for hiding this comment

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

Please fix the conflicts by merging remote main into your main branch.

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.

4 participants