hexStringToNumber(bits: string)

Requires:
@ray-js/panel-sdk≥1.0.0

Description

Convert a hex string to an array of numbers

Parameters

ParameterTypeRequiredDescription
bitsstringYesHex string, e.g., 'AD03'

Return Value

Type: number[]
Array of numbers parsed from each pair of hex characters

Examples

Basic usage

import { utils } from '@ray-js/panel-sdk';

const { hexStringToNumber } = utils;

hexStringToNumber('AD03'); // [173, 3]
hexStringToNumber('FF00'); // [255, 0]

hexStringToBinString(hexString: string)

Requires:
@ray-js/panel-sdk≥1.0.0

Description

Convert a hex string to a binary string

Parameters

ParameterTypeRequiredDescription
hexStringstringYesHex string, e.g., 'A7B9'

Return Value

Type: string
The corresponding binary string, 8 bits per byte

Examples

Basic usage

import { utils } from '@ray-js/panel-sdk';

const { hexStringToBinString } = utils;

hexStringToBinString('A7B9'); // '1010011110111001'
hexStringToBinString('0709'); // '0000011100001001'

camelize(str: string)

Requires:
@ray-js/panel-sdk≥1.0.0

Description

Convert a string to camelCase

Parameters

ParameterTypeRequiredDescription
strstringYesThe string to convert; supports hyphen, underscore, or space separators

Return Value

Type: string
A camelCase string with a lowercase first letter

Examples

Basic usage

import { utils } from '@ray-js/panel-sdk';

const { camelize } = utils;

camelize('background-color'); // 'backgroundColor'
camelize('font_size');        // 'fontSize'
camelize('hello world');      // 'helloWorld'

strToHexString(str: string)

Requires:
@ray-js/panel-sdk≥1.0.0

Description

Extract binary fragments from a string and convert them to a hex string

Parameters

ParameterTypeRequiredDescription
strstringYesA string containing '0' and '1' characters; may include other characters

Return Value

Type: string
The hex string converted from each matched 4-bit binary fragment

Examples

Basic usage

import { utils } from '@ray-js/panel-sdk';

const { strToHexString } = utils;

strToHexString('ababba0102hghg0011100'); // '3'
strToHexString('ababba0102hghg001110011000111'); // '398'