mirror of
https://github.com/harttle/liquidjs.git
synced 2026-09-18 22:10:41 -07:00
fix: respect cache render options
This commit is contained in:
committed by
Jun Yang
parent
3cf8072df5
commit
a93f11d25a
@@ -89,11 +89,13 @@ export function normalize (options?: LiquidOptions): NormalizedOptions {
|
||||
if (options.hasOwnProperty('root')) {
|
||||
options.root = normalizeStringArray(options.root)
|
||||
}
|
||||
let cache: Cache<Template[]> | undefined
|
||||
if (typeof options.cache === 'number') cache = options.cache > 0 ? new LRU(options.cache) : undefined
|
||||
else if (typeof options.cache === 'object') cache = options.cache
|
||||
else cache = options.cache ? new LRU<Template[]>(1024) : undefined
|
||||
options.cache = cache
|
||||
if (options.hasOwnProperty('cache')) {
|
||||
let cache: Cache<Template[]> | undefined
|
||||
if (typeof options.cache === 'number') cache = options.cache > 0 ? new LRU(options.cache) : undefined
|
||||
else if (typeof options.cache === 'object') cache = options.cache
|
||||
else cache = options.cache ? new LRU<Template[]>(1024) : undefined
|
||||
options.cache = cache
|
||||
}
|
||||
return options as NormalizedOptions
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user