typed-array-interleave
Version:
Interleave n typed arrays.
65 lines (45 loc) • 2.91 kB
Markdown
# typed-array-interleave
[](https://www.npmjs.com/package/typed-array-interleave)
[](https://www.npmjs.com/package/typed-array-interleave)
[](https://bundlephobia.com/package/typed-array-interleave)
[](https://github.com/dmnsgn/typed-array-interleave/blob/main/package.json)
[](https://github.com/microsoft/TypeScript)
[](https://conventionalcommits.org)
[](https://github.com/prettier/prettier)
[](https://github.com/eslint/eslint)
[](https://github.com/dmnsgn/typed-array-interleave/blob/main/LICENSE.md)
Interleave n typed arrays.
[](https://paypal.me/dmnsgn)
[](https://commerce.coinbase.com/checkout/56cbdf28-e323-48d8-9c98-7019e72c97f3)
[](https://twitter.com/dmnsgn)
## Installation
```bash
npm install typed-array-interleave
```
## Usage
```js
import typedArrayInterleave from "typed-array-interleave";
typedArrayInterleave(
Uint8Array,
[3, 2],
Uint8Array.of(1, 2, 3, 4, 5, 6),
Uint8Array.of(7, 8, 9, 10)
);
//=> Uint8Array [1, 2, 3, 7, 8, 4, 5, 6, 9, 10]
```
## API
<!-- api-start -->
<a name="module_typedArrayInterleave"></a>
## typedArrayInterleave
<a name="exp_module_typedArrayInterleave--typedArrayInterleave"></a>
### typedArrayInterleave(ResultConstructor, elements, ...arrays) ⇒ <code>TypedArray</code> ⏏
Interleave n typed arrays
**Kind**: Exported function
| Param | Type | Description |
| ----------------- | ----------------------- | ------------------------------------------------ |
| ResultConstructor | <code>TypedArray</code> | Returned typed array constructor |
| elements | <code>Array</code> | Number of elements to group for each typed array |
| ...arrays | <code>TypedArray</code> | Arrays to interleave |
<!-- api-end -->
## License
MIT. See [license file](https://github.com/dmnsgn/typed-array-interleave/blob/main/LICENSE.md).