swiing / bit-typedarray Goto Github PK
View Code? Open in Web Editor NEWA BitArray object exhibiting the interface of standard ecmascript TypedArray's
License: MIT License
A BitArray object exhibiting the interface of standard ecmascript TypedArray's
License: MIT License
> import BitArray from "@bitarray/typedarray"
undefined
> let d = new BitArray([0,1,1], 0, 10)
<repl>.ts:5:31 - error TS2554: Expected 1 arguments, but got 3.
BitArray doesn't seem to support both buffer, byteOffset and length in the constructor, as other TypedArrays do:
new TypedArray(buffer, byteOffset, length)
Current code only partially implements standard features of typed arrays. This issue provides a place to track progress and view it all in one shot.
PRs welcome!
new TypedArray()
new TypedArray(length)
new TypedArray(typedArray)
new TypedArray(object)
new TypedArray(buffer)
: see hereBYTES_PER_ELEMENT
name
get BitArray[@@species]
from()
of()
buffer
byteLength
byteOffset
length
at()
: see here for discussioncopyWithin()
entries()
every()
fill()
filter()
find()
findIndex()
forEach()
includes()
indexOf()
join()
keys()
lastIndexOf()
map()
reduce()
reduceRight()
reverse()
set()
slice()
some()
sort()
subarray()
values()
toString()
: see here for note on implementation.[@@iterator]()
toLocaleString()
: there is no local variation to displaying 1s or 0s.Typed array constructors can take an ArrayBuffer instance as single argument. E.g.:
let buffer = new ArrayBuffer(12);
new Uint32Array(buffer);
The length of the typed array is the length of the buffer, divided by the TypedArray.BYTES_PER_ELEMENT.
If applied to BitArrays, that would imply the length of BitArrays can only be multiple of 8. However, there is no reason that length of bit arrays should be so. Hence, I have written:
I have not yet made my mind whether it makes sense to construct a
BitArray
by passing an array buffer to the constructor.
This issue is created to open the discussion.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.