mirror of
https://github.com/harttle/liquidjs.git
synced 2026-09-15 20:30:39 -07:00
- Add createScope() building Object.create(null) with optional own props - Initialize context stack bottom with createScope() for assign/capture - Push null-proto scopes from for, tablerow, block, layout, include (incl. Jekyll) Co-authored-by: Cursor <[email protected]>
14 lines
337 B
TypeScript
14 lines
337 B
TypeScript
import { Drop } from '../drop/drop'
|
|
|
|
export interface ScopeObject extends Record<string | number | symbol, any> {
|
|
toLiquid?: () => any;
|
|
}
|
|
|
|
export type Scope = ScopeObject | Drop
|
|
|
|
export function createScope (from?: ScopeObject): ScopeObject {
|
|
const scope = Object.create(null)
|
|
if (from) Object.assign(scope, from)
|
|
return scope
|
|
}
|