Files
RahulGautamSingh 76f911041a refactor: use named exports (#39196)
* use named exports

* fix test

* add missing imnport

* fix prettier
2025-11-10 12:00:35 +00:00

17 lines
450 B
TypeScript

import { isBoolean } from '@sindresorhus/is';
const stringMapping: ReadonlyMap<string, boolean> = new Map<string, boolean>([
['True', true],
['False', false],
]);
export const booleanStringValues = Array.from(stringMapping.keys());
export function asBoolean(value: string): boolean {
const result = stringMapping.get(value);
if (isBoolean(result)) {
return result;
}
throw new Error(`Invalid Starlark boolean string: ${value}`);
}