![Create React App Officially Deprecated Amid React 19 Compatibility Issues](https://cdn.sanity.io/images/cgdhsj6q/production/04fa08cf844d798abc0e1a6391c129363cc7e2ab-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Create React App Officially Deprecated Amid React 19 Compatibility Issues
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
@blakek/array-split
Advanced tools
💔 Split and chunk arrays, strings, and more
Functions to help split an array at an index and chunk an array into pieces.
Using Yarn:
$ yarn add @blakek/array-split
…or using npm:
$ npm i --save @blakek/array-split
chunk
function chunk<T extends Sliceable>(chunkSize: number, array: T): T[];
Chunks an array into pieces of a given size.
import { chunk } from '@blakek/array-split';
chunk(2, [1, 2, 3, 4]);
//» [[1, 2], [3, 4]]
chunk(3, 'abcdefghij');
//» ['abc', 'def', 'ghi', 'j']
chunk(3, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]);
//» [[1, 2, 3], [4, 5, 6], [7, 8, 9], [10, 11]]
splitAtIndex
function splitAtIndex<T extends Sliceable>(index: number, array: T): T[];
Splits an array into two pieces at the given index. Anything below the index is in the first array, the index and above are the second array.
Note, you may pass a negative index to split at the end of the array.
import { splitAtIndex } from '@blakek/array-split';
splitAtIndex(0, [1, 2, 3, 4]);
//» [[], [1, 2, 3, 4]]
splitAtIndex(1, [1, 2, 3, 4]);
//» [[ 1 ], [2, 3, 4]]
splitAtIndex(-1, ['a', 'b', 'c']);
//» [[ 'a', 'b' ], ['c']]
splitAtIndex(3, ['a', 'b', 'c', 'd', 'e']);
//» [['a', 'b', 'c'], ['d', 'e']]
splitAtIndex(1, 'abc');
//» ['a', 'bc']
splitAtIndices
function splitAtIndices<T extends Sliceable>(
[index, nextIndex, ...indices]: number[],
array: T
): T[];
Similar to splitAtIndex
but slices an array at multiple indices.
import { splitAtIndices } from '@blakek/array-split';
splitAtIndices([1, 3], ['a', 'b', 'c', 'd', 'e']);
//» [['a'], ['b', 'c'], ['d', 'e']]
splitAtIndices([2, 5], 'blakek');
//» ['bl', 'ake', 'k']
splitAtIndices([-4, -1], 'github');
//» ['gi', 'thu', 'b']
Node.js and Yarn are required to work with this project.
To install all dependencies, run:
yarn
yarn build | Builds the project to ./dist |
yarn format | Format the source following the Prettier styles |
yarn test | Run project tests |
yarn test --watch | Run project tests, watching for file changes |
MIT
FAQs
💔 Split and chunk arrays, strings, and more
The npm package @blakek/array-split receives a total of 3 weekly downloads. As such, @blakek/array-split popularity was classified as not popular.
We found that @blakek/array-split demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.