MCPcopy Create free account
hub / github.com/Effect-TS/effect / parseScalar

Function parseScalar

packages/effect/src/encoding/Yaml.ts:518–528  ·  view source on GitHub ↗
(input: string)

Source from the content-addressed store, hash-verified

516}
517
518const parseScalar = (input: string): unknown => {
519 const value = trimWhite(input)
520 if (value.length === 0) return null
521 if (value.startsWith("\"") && value.endsWith("\"")) {
522 return parseDoubleQuoted(value)
523 }
524 if (value.startsWith("'") && value.endsWith("'")) {
525 return value.slice(1, -1).replace(/''/g, "'")
526 }
527 return resolvePlain(value)
528}
529
530const parseKey = (input: string): string => {
531 const value = parseScalar(input)

Callers 4

parseKeyFunction · 0.85
parseValueMethod · 0.85
parsePlainValueMethod · 0.85
parseQuotedValueMethod · 0.85

Calls 5

trimWhiteFunction · 0.85
parseDoubleQuotedFunction · 0.85
resolvePlainFunction · 0.85
sliceMethod · 0.80
replaceMethod · 0.45

Tested by

no test coverage detected