Hierarchy
- Context
Constructors
constructor
+ new Context(env: object, opts: NormalizedFullOptions, renderOptions: RenderOptions): Context
Defined in src/context/context.ts:35
Parameters:
| Name | Type | Default |
|---|---|---|
env |
object | {} |
opts |
NormalizedFullOptions | defaultOptions |
renderOptions |
RenderOptions | {} |
Returns: Context
Properties
environments
• environments: Scope
Defined in src/context/context.ts:21
user passed in scope{% increment %}, {% decrement %} changes this scope,
whereas {% capture %}, {% assign %} only hide this scope
globals
• globals: Scope
Defined in src/context/context.ts:25
global scope used as fallback for missing variables
opts
• opts: NormalizedFullOptions
Defined in src/context/context.ts:30
The normalized liquid options object
ownPropertyOnly
• ownPropertyOnly: boolean
Defined in src/context/context.ts:35
Private registers
• registers: object
Defined in src/context/context.ts:15
Type declaration:
Private scopes
• scopes: Scope[] = [{}]
Defined in src/context/context.ts:14
insert a Context-level empty scope,
for tags like {% capture %} {% assign %} to operate
strictVariables
• strictVariables: boolean
Defined in src/context/context.ts:34
Throw when accessing undefined variable?
sync
• sync: boolean
Defined in src/context/context.ts:26
Methods
_get
▸ _get(paths: PropertyKey[]): IterableIterator‹unknown›
Defined in src/context/context.ts:66
Parameters:
| Name | Type |
|---|---|
paths |
PropertyKey[] |
Returns: IterableIterator‹unknown›
_getFromScope
▸ _getFromScope(scope: unknown, paths: PropertyKey[] | string): IterableIterator‹unknown›
Defined in src/context/context.ts:76
Parameters:
| Name | Type |
|---|---|
scope |
unknown |
paths |
PropertyKey[] | string |
Returns: IterableIterator‹unknown›
bottom
▸ bottom(): Scope
Defined in src/context/context.ts:92
Returns: Scope
Private findScope
▸ findScope(key: string | number): Scope
Defined in src/context/context.ts:95
Parameters:
| Name | Type |
|---|---|
key |
string | number |
Returns: Scope
get
▸ get(paths: PropertyKey[]): unknown
Defined in src/context/context.ts:63
deprecated use _get() instead
Parameters:
| Name | Type |
|---|---|
paths |
PropertyKey[] |
Returns: unknown
getAll
▸ getAll(): Scope
Defined in src/context/context.ts:56
Returns: Scope
getFromScope
▸ getFromScope(scope: unknown, paths: PropertyKey[] | string): IterableIterator‹unknown›
Defined in src/context/context.ts:73
deprecated use _get() instead
Parameters:
| Name | Type |
|---|---|
scope |
unknown |
paths |
PropertyKey[] | string |
Returns: IterableIterator‹unknown›
getRegister
▸ getRegister(key: string): any
Defined in src/context/context.ts:44
Parameters:
| Name | Type |
|---|---|
key |
string |
Returns: any
pop
▸ pop(): undefined | ScopeObject‹› | Drop‹›
Defined in src/context/context.ts:89
Returns: undefined | ScopeObject‹› | Drop‹›
push
▸ push(ctx: object): number
Defined in src/context/context.ts:86
Parameters:
| Name | Type |
|---|---|
ctx |
object |
Returns: number
restoreRegister
▸ restoreRegister(keyValues: [string, any][]): void
Defined in src/context/context.ts:53
Parameters:
| Name | Type |
|---|---|
keyValues |
[string, any][] |
Returns: void
saveRegister
▸ saveRegister(…keys: string[]): [string, any][]
Defined in src/context/context.ts:50
Parameters:
| Name | Type |
|---|---|
...keys |
string[] |
Returns: [string, any][]
setRegister
▸ setRegister(key: string, value: any): any
Defined in src/context/context.ts:47
Parameters:
| Name | Type |
|---|---|
key |
string |
value |
any |
Returns: any