MCPcopy Create free account
hub / github.com/compiler-explorer/compiler-explorer / toProperty

Function toProperty

lib/utils.ts:466–472  ·  view source on GitHub ↗
(prop: string)

Source from the content-addressed store, hash-verified

464}
465
466export function toProperty(prop: string): boolean | number | string {
467 if (prop === 'true' || prop === 'yes') return true;
468 if (prop === 'false' || prop === 'no') return false;
469 if (/^-?(0|[1-9]\d*)$/.test(prop)) return Number.parseInt(prop, 10);
470 if (/^-?\d*\.\d+$/.test(prop)) return Number.parseFloat(prop);
471 return prop;
472}
473
474// Initially based on http://philzimmermann.com/docs/human-oriented-base-32-encoding.txt
475const BASE32_ALPHABET = '13456789EGKMPTWYabcdefhjnoqrsvxz';

Callers 1

parsePropertiesFunction · 0.85

Calls 1

testMethod · 0.80

Tested by

no test coverage detected