Skip to content

marmotte / utils/codegen/format

utils/codegen/format

Type Aliases

CommentType

CommentType = "//" | "#" | "xml"

Defined in: src/utils/codegen/format.ts:1

Functions

comment()

comment(content, type): string

Defined in: src/utils/codegen/format.ts:38

Parameters

content

string

type

CommentType

Returns

string


indent()

indent(code, indentation, skipLines?): string

Defined in: src/utils/codegen/format.ts:49

Parameters

code

string

indentation

string

skipLines?

false | RegExp | (line) => boolean

Returns

string


registerCommentTypeResolver()

registerCommentTypeResolver(type, pattern, important?): void

Defined in: src/utils/codegen/format.ts:18

Register a new resolver for resolveCommentType

Parameters

type

CommentType

pattern

RegExp

If matched type will be returned by resolveCommentType

important?

boolean = false

if true, this resolver will have higher priority (false by default)

Returns

void


resolveCommentType()

resolveCommentType(filePath, check): CommentType

Defined in: src/utils/codegen/format.ts:30

Detects CommentType from file path

Additional resolvers can be registered with registerCommentTypeResolver

Parameters

filePath

string

check

true

If true will throw an error

Returns

CommentType