Const
Transforms each element of an array using a mapping function.
Operates on arrayData passed from previous operations. The mapFunction receives each item and optionally its index.
Operation data with mappedArray containing transformed elements
mappedArray
// Double each numberconst result = mapArray({ arrayData: [1, 2, 3, 4], mapFunction: (item) => item * 2});// result.mappedArray = [2, 4, 6, 8] Copy
// Double each numberconst result = mapArray({ arrayData: [1, 2, 3, 4], mapFunction: (item) => item * 2});// result.mappedArray = [2, 4, 6, 8]
// Extract property from objectsconst result = mapArray({ arrayData: [{name: 'Alice', age: 25}, {name: 'Bob', age: 30}], mapFunction: (item) => item.name});// result.mappedArray = ['Alice', 'Bob'] Copy
// Extract property from objectsconst result = mapArray({ arrayData: [{name: 'Alice', age: 25}, {name: 'Bob', age: 30}], mapFunction: (item) => item.name});// result.mappedArray = ['Alice', 'Bob']
// Use index in transformationconst result = mapArray({ arrayData: ['a', 'b', 'c'], mapFunction: (item, index) => `${index}-${item}`});// result.mappedArray = ['0-a', '1-b', '2-c'] Copy
// Use index in transformationconst result = mapArray({ arrayData: ['a', 'b', 'c'], mapFunction: (item, index) => `${index}-${item}`});// result.mappedArray = ['0-a', '1-b', '2-c']
Transforms each element of an array using a mapping function.
Operates on arrayData passed from previous operations. The mapFunction receives each item and optionally its index.