MCPcopy Index your code
hub / github.com/AnswerOverflow/AnswerOverflow / toBitfield

Function toBitfield

packages/core/src/utils/bitfieldUtils.ts:15–25  ·  view source on GitHub ↗
(
	...keys: T
)

Source from the content-addressed store, hash-verified

13}
14
15export function toBitfield<T extends readonly string[]>(
16 ...keys: T
17): Record<T[number], number> {
18 return toDict(
19 (_, index) => {
20 const val = 1 << index;
21 return val;
22 },
23 ...keys,
24 ) as Record<T[number], number>;
25}
26
27export function bitfieldToDict<T extends readonly string[]>(
28 value: number,

Callers 2

bitfieldToDictFunction · 0.85
dictToBitfieldFunction · 0.85

Calls 1

toDictFunction · 0.85

Tested by

no test coverage detected