typedoc-plugin-markdown
Version:
A TypeDoc plugin that generates TypeScript API documentation as Markdown.
11 lines (10 loc) • 380 B
JavaScript
/**
* The name of a property as it is written in TypeScript: quoted unless it is
* an identifier, a number, or a symbol name such as `[dispose]`, so that
* `"prop.with.dot": string` is not rendered as `prop.with.dot: string`.
*/
export function getPropertyName(name) {
return /^([A-Z_$][\w$]*|\d+|\[[^\]]+\])$/i.test(name)
? name
: JSON.stringify(name);
}