MCPcopy Index your code
hub / github.com/Doorman11991/smallcode / parseTomlValue

Function parseTomlValue

bin/config.js:99–108  ·  view source on GitHub ↗
(raw)

Source from the content-addressed store, hash-verified

97}
98
99function parseTomlValue(raw) {
100 const value = stripInlineComment(raw);
101 if ((value.startsWith('"') && value.endsWith('"')) || (value.startsWith("'") && value.endsWith("'"))) {
102 return value.slice(1, -1);
103 }
104 if (value === 'true') return true;
105 if (value === 'false') return false;
106 if (/^-?\d+$/.test(value)) return parseInt(value, 10);
107 return value;
108}
109
110function parseTomlConfig(content) {
111 const out = {};

Callers 1

parseTomlConfigFunction · 0.85

Calls 1

stripInlineCommentFunction · 0.85

Tested by

no test coverage detected