mirror of
https://github.com/lewismoten/data-over-audio.git
synced 2026-03-30 23:58:31 +08:00
wip: big refactor
This commit is contained in:
10
converters.js
Normal file
10
converters.js
Normal file
@@ -0,0 +1,10 @@
|
||||
export const bitsToInt = (bits, bitLength) => {
|
||||
parseInt(bits
|
||||
// only grab the bits we need
|
||||
.slice(0, bitLength)
|
||||
// combine into string
|
||||
.join('')
|
||||
// Assume missing bits were zeros
|
||||
.padEnd(bitLength, '0')
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user