mirror of
https://github.com/harttle/liquidjs.git
synced 2026-10-03 00:55:13 -07:00
* feat: WIP async Drop valueOf resolution (#948) Incomplete/abandoned implementation of async Drop.valueOf() awaited across the render pipeline. Kept for reference only; known to be inconsistent and not production-ready. Co-authored-by: Cursor <[email protected]> * feat!: resolve async Drop.valueOf() for filters and tags Co-authored-by: Cursor <[email protected]> * fix: keep Drops on filter and tag inputs Filters and tag arguments still receive the Drop. Await valueOf() at output, conditions, and operators, and restore the existing render/include Drop tests. Co-authored-by: Cursor <[email protected]> --------- Co-authored-by: Cursor <[email protected]>
This commit is contained in:
@@ -38,7 +38,7 @@ The following modified template also contains 3 values to random from, but they'
|
||||
It can be tricky to parse all these cases manually, but there's a [Tokenizer][Tokenizer] class in LiquidJS you can make use of.
|
||||
|
||||
```javascript
|
||||
const { Liquid, Tokenizer, evalToken } = require('liquidjs')
|
||||
const { Liquid, Tokenizer, evalTokenValue } = require('liquidjs')
|
||||
engine.registerTag('random', {
|
||||
parse(tagToken) {
|
||||
const tokenizer = new Tokenizer(tagToken.args)
|
||||
@@ -52,7 +52,7 @@ engine.registerTag('random', {
|
||||
const index = Math.floor(this.items.length * Math.random())
|
||||
const token = this.items[index]
|
||||
// in LiquidJS, we use yield to wait for async call
|
||||
const value = yield evalToken(token, context)
|
||||
const value = yield evalTokenValue(token, context)
|
||||
emitter.write(value)
|
||||
}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user