Skip to content

Source

Source represents the contents of a single policy file.

  • Source

new Source(sourceValue): Source

constructor wraps the common CEL source used by a policy.

Source

Source

content(): string

content returns the source contents.

string

CommonSource.content


description(): string

description returns the source location description.

string

CommonSource.description


lineOffsets(): number[]

lineOffsets returns the source line offsets.

number[]

CommonSource.lineOffsets


location(line, column): Location

location constructs a source location.

number

number

Location

CommonSource.location


locationOffset(location): [number, boolean]

locationOffset translates a location to its source offset.

Location

[number, boolean]

CommonSource.locationOffset


offsetLocation(offset): [Location, boolean]

offsetLocation translates a source offset to its location.

number

[Location, boolean]

CommonSource.offsetLocation


relative(content, line, column): RelativeSource

relative produces a RelativeSource object for content at an absolute location within the parent source.

string

number

number

RelativeSource


snippet(line): [string, boolean]

snippet returns the requested source line when present.

number

[string, boolean]

CommonSource.snippet