1.0.4 • Published 1 year ago

@vandeurenglenn/typed-array-smart-concat v1.0.4

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

typed-array-smart-concat

TypedArray.set() the concat() way

install

npm i @vandeurenglenn/typed-array-smart-concat

usage

concat

import typedArraySmartConcat from '@vandeurenglenn/typed-array-smart-concat'

const concated = typedArraySmartConcat([
  new TextEncoder('hello'),
  new TextEncoder('world')
])

console.log(new TextDecoder().decode(concated)) // <length><value><length><value>

deconcat

import typedArraySmartDeconcat from '@vandeurenglenn/typed-array-smart-deconcat'

const deconcated = typedArraySmartDeconcat(concated)

console.log(new TextDecoder().decode(deconcated[0])) // hello
console.log(new TextDecoder().decode(deconcated[1])) // world