Skip to content

Array Operations

List manipulation — chunk, flatten, group, map, reduce, zip, and more.

12 modules

ModuleDescription
配列チャンク配列を指定サイズのチャンクに分割する
コンパクト配列からnull/空の値を削除
配列差分最初の配列にあって他の配列にない要素を取得する
削除配列から最初のN要素を削除
配列平坦化ネストされた配列を単一の配列に平坦化する
グループ化キーで配列要素をグループ化
配列交差配列間の共通要素を取得する
配列結合配列要素を文字列に結合する
配列マップ配列の各要素を変換する
配列集約配列を単一の値に集約する
取得配列から最初のN要素を取得
配列をジップ複数の配列を要素ごとに結合

Modules

配列チャンク

array.chunk

配列を指定サイズのチャンクに分割する

Parameters:

NameTypeRequiredDefaultDescription
arrayarrayYes-Array of items to process. Can be numbers, strings, or objects.
sizenumberYes10Number of items per chunk

Output:

FieldTypeDescription
resultarrayチャンクの配列
chunksnumberチャンクの配列

Example: Chunk into groups of 3

yaml
array: [1, 2, 3, 4, 5, 6, 7, 8, 9]
size: 3

Example: Batch process items

yaml
array: ["a", "b", "c", "d", "e"]
size: 2

コンパクト

array.compact

配列からnull/空の値を削除

Parameters:

NameTypeRequiredDefaultDescription
arrayarrayYes-コンパクト化する配列
remove_empty_stringsbooleanNoTrue空の文字列を削除
remove_zerobooleanNoFalse空の文字列を削除
remove_falsebooleanNoFalseゼロ値を削除

Output:

FieldTypeDescription
resultarrayfalse値を削除
removednumberコンパクト化された配列

配列差分

array.difference

最初の配列にあって他の配列にない要素を取得する

Parameters:

NameTypeRequiredDefaultDescription
arrayarrayYes-Array of items to process. Can be numbers, strings, or objects.
subtractarrayYes-Arrays containing items to remove from the base array

Output:

FieldTypeDescription
resultarray最初の配列に固有の要素
lengthnumber差分要素の数

Example: Find unique elements

yaml
array: [1, 2, 3, 4, 5]
subtract: [[2, 4], [5]]

削除

array.drop

配列から最初のN要素を削除

Parameters:

NameTypeRequiredDefaultDescription
arrayarrayYes-元の配列
countnumberYes1元の配列

Output:

FieldTypeDescription
resultarray削除する要素の数
droppednumber残りの要素

配列平坦化

array.flatten

ネストされた配列を単一の配列に平坦化する

Parameters:

NameTypeRequiredDefaultDescription
arrayarrayYes-Array of items to process. Can be numbers, strings, or objects.
depthnumberNo1How many levels of nesting to flatten (-1 for infinite)

Output:

FieldTypeDescription
resultarray平坦化された配列
lengthnumber平坦化された配列の長さ

Example: Flatten one level

yaml
array: [[1, 2], [3, 4], [5, 6]]
depth: 1

Example: Flatten all levels

yaml
array: [[1, [2, [3, [4]]]]]
depth: -1

グループ化

array.group_by

キーで配列要素をグループ化

Parameters:

NameTypeRequiredDefaultDescription
arrayarrayYes-グループ化するオブジェクトの配列
keystringYes-グループ化するオブジェクトの配列

Output:

FieldTypeDescription
groupsobjectグループ化するプロパティ名
keysarrayグループ化された結果
countnumberグループ化された結果

配列交差

array.intersection

配列間の共通要素を取得する

Parameters:

NameTypeRequiredDefaultDescription
arraysarrayYes-Array of arrays to process (for intersection, union)

Output:

FieldTypeDescription
resultarray共通要素
lengthnumber共通要素の数

Example: Find common elements

yaml
arrays: [[1, 2, 3, 4], [2, 3, 5], [2, 3, 6]]

配列結合

array.join

配列要素を文字列に結合する

Parameters:

NameTypeRequiredDefaultDescription
arrayarrayYes-Array of items to process. Can be numbers, strings, or objects.
separatorselect (, , ,, , `
, , - `, ``)No,String to insert between items when joining

Output:

FieldTypeDescription
resultstring結合された文字列

Example: Join with comma

yaml
array: ["apple", "banana", "cherry"]
separator: ,

Example: Join with newline

yaml
array: ["Line 1", "Line 2", "Line 3"]
separator:

配列マップ

array.map

配列の各要素を変換する

Parameters:

NameTypeRequiredDefaultDescription
arrayarrayYes-Array of items to process. Can be numbers, strings, or objects.
operationselect (multiply, add, subtract, divide, extract, uppercase, lowercase, trim, tostring, tonumber)Yes-Transformation to apply to each item
valueanyNo-Value for the operation: number for math operations, field name for extract

Output:

FieldTypeDescription
resultarray変換された配列
lengthnumber変換された配列の長さ

Example: Multiply numbers

yaml
array: [1, 2, 3, 4, 5]
operation: multiply
value: 2

Example: Extract field from objects

yaml
array: [{"name": "Alice", "age": 30}, {"name": "Bob", "age": 25}]
operation: extract
value: name

配列集約

array.reduce

配列を単一の値に集約する

Parameters:

NameTypeRequiredDefaultDescription
arrayarrayYes-Array of items to process. Can be numbers, strings, or objects.
operationselect (sum, product, average, min, max, count, join, first, last)Yes-How to combine all items into a single value
separatorselect (, , ,, , `
, , - `, ``)No,String to insert between items when joining

Output:

FieldTypeDescription
resultany集約された値
operationstring実行された操作

Example: Sum numbers

yaml
array: [1, 2, 3, 4, 5]
operation: sum

Example: Join strings

yaml
array: ["Hello", "World", "from", "Flyto"]
operation: join
separator:

取得

array.take

配列から最初のN要素を取得

Parameters:

NameTypeRequiredDefaultDescription
arrayarrayYes-元の配列
countnumberYes1元の配列

Output:

FieldTypeDescription
resultarray取得する要素の数
lengthnumber取得した要素

配列をジップ

array.zip

複数の配列を要素ごとに結合

Parameters:

NameTypeRequiredDefaultDescription
arraysarrayYes-ジップする配列の配列
fill_valueanyNo-ジップする配列の配列

Output:

FieldTypeDescription
resultarray欠損要素の値
lengthnumberジップされた配列

Released under the Apache 2.0 License.