MCPcopy Create free account
hub / github.com/SAP-samples/cloud-cap-hana-swapi / normalizeString

Function normalizeString

scripts/scraper/normalize.js:5–11  ·  view source on GitHub ↗
(value)

Source from the content-addressed store, hash-verified

3const NULL_VALUES = new Set(['unknown', 'n/a', 'none', 'null', 'n/a.'])
4
5function normalizeString(value) {
6 if (value === undefined || value === null) return null
7 const s = String(value).trim()
8 if (!s) return null
9 if (NULL_VALUES.has(s.toLowerCase())) return null
10 return s
11}
12
13/**
14 * Format a parsed Date as YYYY-MM-DD without shifting the calendar day.

Callers 11

normalizeDateFunction · 0.70
normalizeIntegerFunction · 0.70
resolveFieldFunction · 0.70
normalize.test.jsFile · 0.50
extractPersonFunction · 0.50
extractFilmFunction · 0.50
extractSpeciesFunction · 0.50
extractVehicleFunction · 0.50
extractPlanetFunction · 0.50
extractEpisodeFunction · 0.50
extractStarshipFunction · 0.50

Calls

no outgoing calls

Tested by

no test coverage detected