{
"id": "fn-array-collect",
"dataComponent": "array",
"heading": {
"title": "collect",
"badges": ["Array"]
},
"synopsis": "Collects all items from an InkIterator into a MixedArray, or returns the array unchanged if already an array.",
"codeBlocks": [
"extend(\"array\")\n\niter = ink(1, 4)\narr = array:collect(iter)\nsput(arr)\n// => [1,2,3]\n\n# If given an array, just returns it:\nsput(array:collect([7,8]))\n// => [7,8]"
],
"notes": [
"Takes one argument: an InkIterator or an array.",
"Returns a MixedArray of all items, or the original array.",
"If used on an InkIterator, all items are collected eagerly."
]
}