mirror of
https://github.com/harttle/liquidjs.git
synced 2026-09-16 21:00:40 -07:00
feat: implement forloop.name as found in ruby shopify/liquid
This commit is contained in:
@@ -2,10 +2,12 @@ import { Drop } from './drop'
|
||||
|
||||
export class ForloopDrop extends Drop {
|
||||
protected i = 0
|
||||
public name: string
|
||||
public length: number
|
||||
public constructor (length: number) {
|
||||
public constructor (length: number, collection: string, variable: string) {
|
||||
super()
|
||||
this.length = length
|
||||
this.name = `${variable}-${collection}`
|
||||
}
|
||||
public next () {
|
||||
this.i++
|
||||
|
||||
@@ -2,8 +2,8 @@ import { ForloopDrop } from './forloop-drop'
|
||||
|
||||
export class TablerowloopDrop extends ForloopDrop {
|
||||
private cols: number
|
||||
public constructor (length: number, cols: number) {
|
||||
super(length)
|
||||
public constructor (length: number, cols: number, collection: string, variable: string) {
|
||||
super(length, collection, variable)
|
||||
this.length = length
|
||||
this.cols = cols
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user