Source
Source represents the contents of a single policy file.
Implements
Section titled “Implements”Source
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new Source(
sourceValue):Source
constructor wraps the common CEL source used by a policy.
Parameters
Section titled “Parameters”sourceValue
Section titled “sourceValue”Source
Returns
Section titled “Returns”Source
Methods
Section titled “Methods”content()
Section titled “content()”content():
string
content returns the source contents.
Returns
Section titled “Returns”string
Implementation of
Section titled “Implementation of”CommonSource.content
description()
Section titled “description()”description():
string
description returns the source location description.
Returns
Section titled “Returns”string
Implementation of
Section titled “Implementation of”CommonSource.description
lineOffsets()
Section titled “lineOffsets()”lineOffsets():
number[]
lineOffsets returns the source line offsets.
Returns
Section titled “Returns”number[]
Implementation of
Section titled “Implementation of”CommonSource.lineOffsets
location()
Section titled “location()”location(
line,column):Location
location constructs a source location.
Parameters
Section titled “Parameters”number
column
Section titled “column”number
Returns
Section titled “Returns”Location
Implementation of
Section titled “Implementation of”CommonSource.location
locationOffset()
Section titled “locationOffset()”locationOffset(
location): [number,boolean]
locationOffset translates a location to its source offset.
Parameters
Section titled “Parameters”location
Section titled “location”Location
Returns
Section titled “Returns”[number, boolean]
Implementation of
Section titled “Implementation of”CommonSource.locationOffset
offsetLocation()
Section titled “offsetLocation()”offsetLocation(
offset): [Location,boolean]
offsetLocation translates a source offset to its location.
Parameters
Section titled “Parameters”offset
Section titled “offset”number
Returns
Section titled “Returns”[Location, boolean]
Implementation of
Section titled “Implementation of”CommonSource.offsetLocation
relative()
Section titled “relative()”relative(
content,line,column):RelativeSource
relative produces a RelativeSource object for content at an absolute location within the parent source.
Parameters
Section titled “Parameters”content
Section titled “content”string
number
column
Section titled “column”number
Returns
Section titled “Returns”snippet()
Section titled “snippet()”snippet(
line): [string,boolean]
snippet returns the requested source line when present.
Parameters
Section titled “Parameters”number
Returns
Section titled “Returns”[string, boolean]
Implementation of
Section titled “Implementation of”CommonSource.snippet