typed-integers
v1.3.1
Published
Typed Integers
Maintainers
Readme
typed-integers
npm i typed-integersUsage
Utility types, for readability and support only. Type conversion required.
i8i16i32u8u16u32f32f64
Example:
const num1 = <u8>10
const num2 = 2000 as u16Classes with real implementation
Int8Int16Int32Uint8Uint16Uint32Float32Float64
Example:
const num1 = new Uint8(-10) // 246
const num2: u8 = num1.toType()
const num2: number = num1.valueOf()Utils
toTypedArraytoArray
API:
toTypedArray(values, type)toArray(values, type)
Example:
const nums: Uint8[] = toArray([10, 20, 30], 'Uint8')
const typed: Uint8Array = toTypedArray(nums, 'Uint8Array')