mirror of
https://github.com/harttle/liquidjs.git
synced 2026-09-16 12:50:38 -07:00
feat: export Operators from operator.ts
This commit is contained in:
committed by
Jun Yang
parent
bc87e19e3e
commit
6a7c280f04
@@ -3,7 +3,7 @@ import { Template } from './template/template'
|
||||
import { Cache } from './cache/cache'
|
||||
import { LRU } from './cache/lru'
|
||||
import { FS } from './fs/fs'
|
||||
import { operatorImpls, OperatorMap } from './render/operator'
|
||||
import { Operators, OperatorMap } from './render/operator'
|
||||
|
||||
export interface LiquidOptions {
|
||||
/** A directory or an array of directories from where to resolve layout and include templates, and the filename passed to `.renderFile()`. If it's an array, the files are looked up in the order they occur in the array. Defaults to `["."]` */
|
||||
@@ -102,7 +102,7 @@ export const defaultOptions: NormalizedFullOptions = {
|
||||
lenientIf: false,
|
||||
globals: {},
|
||||
keepOutputType: false,
|
||||
operators: operatorImpls
|
||||
operators: Operators
|
||||
}
|
||||
|
||||
export function normalize (options?: LiquidOptions): NormalizedOptions {
|
||||
|
||||
@@ -7,7 +7,7 @@ export interface OperatorMap {
|
||||
[key: string]: (lhs: any, rhs: any, ctx: Context) => boolean;
|
||||
}
|
||||
|
||||
export const operatorImpls: OperatorMap = {
|
||||
export const Operators: OperatorMap = {
|
||||
'==': (l: any, r: any) => {
|
||||
if (isComparable(l)) return l.equals(r)
|
||||
if (isComparable(r)) return r.equals(l)
|
||||
|
||||
+1
-1
@@ -19,4 +19,4 @@ export { Tokenizer } from './parser/tokenizer'
|
||||
export { Hash } from './template/tag/hash'
|
||||
export { evalToken, evalQuotedToken } from './render/expression'
|
||||
export { toPromise, toThenable, toValue } from './util/async'
|
||||
export { OperatorMap } from './render/operator'
|
||||
export { Operators, OperatorMap } from './render/operator'
|
||||
|
||||
Reference in New Issue
Block a user