Array manipulation

arrayJoin( separator )

Flattens an array of a string or a number.

Parameters
Description
Type

separator

[optional] item separator (, by default)

string

Examples

['homer','bart','lisa']:arrayJoin() // "homer, bart, lisa"
['homer','bart','lisa']:arrayJoin(' | ') // "homer | bart | lisa"
['homer','bart','lisa']:arrayJoin('') // "homerbartlisa"
[10,50]:arrayJoin() // "10, 50"
[]:arrayJoin() // ""
null:arrayJoin() // null
{}:arrayJoin() // {}
20:arrayJoin() // 20
undefined:arrayJoin() // undefined

arrayMap( objSeparator, attributeSeparator, attributes )

Parameters
Description
Type

objSeparator

  • [optional] object separator

  • , by default

string

attributeSeparator

  • [optional] attribute separator

  • : by default

string

attributes

[optional] list of object's attributes to print

string

Examples

[{'id':2,'name':'homer'},{'id':3,'name':'bart'}]:arrayMap() // "2:homer, 3:bart"
[{'id':2,'name':'homer'},{'id':3,'name':'bart'}]:arrayMap(' - ') // "2:homer - 3:bart"
[{'id':2,'name':'homer'},{'id':3,'name':'bart'}]:arrayMap(' ; ', '|') // "2|homer ; 3|bart"
[{'id':2,'name':'homer'},{'id':3,'name':'bart'}]:arrayMap(' ; ', '|', 'id') // "2 ; 3"
[{'id':2,'name':'homer','obj':{'id':20},'arr':[12,23]}]:arrayMap() // "2:homer"
['homer','bart','lisa']:arrayMap() // "homer, bart, lisa"
[10,50]:arrayMap() // "10, 50"
[]:arrayMap() // ""
null:arrayMap() // null
{}:arrayMap() // {}
20:arrayMap() // 20
undefined:arrayMap() // undefined

count( start )

  • counts and prints a row number of any array

  • usage example: d[i].id:count() prints a counter of the current row no matter the value of id

  • internally replaced by :cumCount

Parameters
Description
Type

start

number to start with (default: 1)

string

Last updated