MCPcopy Create free account
hub / github.com/loopbackio/loopback-next / escapePropertyName

Function escapePropertyName

packages/cli/generators/openapi/utils.js:170–175  ·  view source on GitHub ↗

* Escape the property if it's not a valid JavaScript identifer * @param {string} name

(name)

Source from the content-addressed store, hash-verified

168 * @param {string} name
169 */
170function escapePropertyName(name) {
171 if (JS_KEYWORDS.includes(name) || !name.match(SAFE_IDENTIFER)) {
172 return printSpecObject(name);
173 }
174 return name;
175}
176
177/**
178 * Escape a string to be used as a block comment

Callers 1

mapObjectTypeFunction · 0.85

Calls 2

printSpecObjectFunction · 0.85
matchMethod · 0.65

Tested by

no test coverage detected