Log in to your AppGyver account to give feedback
1
Array manipulation formula functions
planned
Proposing the following new formula functions that make it easier to work with lists (arrays) of items: INSERT_ITEM_AT(array: Array<X>, index: Number, newItem: X) => Array<X> Return a copy of the array where a new item is inserted at the given index, pushing any following items to greater indexes. INSERT_ITEMS_AT(array: Array<X>, index: Number, newItems: Array<X>) => Array<X> Return a copy of the array where multiple new items are inserted at the given index, pushing any following items to greater indexes. REMOVE_AT(array: Array<X>, index: Number, removeCount: Number = 1) => Array<X> Returns an array where an item at the given index is removed. If removeCount parameter is provided, returns that many items starting at the index. The removeCount parameter defaults to 1. SET_ITEM_AT<item, index>(array: Array<X>, index: Number, setterFormula: X) => Array<X> Returns an array where an item at the given index is replaced with another value. If the array is shorter than the given index, then its length is increased, filling the new indexes with undefined values. SPLICE(array: Array<X>, index: Number, removeCount: Number, newItems: Array<X>) => Array<X> Similarly to JavaScript's splice method, removes the given number of items from an array at the given index, and then adds the given items there. This is a shortcut for combining REMOVE_AT and INSERT_ITEMS_AT. FLATTEN(array: Array<Array<X>>) => Array<X> Takes an array of arrays and concatenates each of those arrays together, returning a flattened array. FLAT_MAP(array: Array<X>, mapFormula: Array<Y>) => Array<Y> Returns an array where each item is mapped to an array of new items, and all those arrays are concatenated together. Equivalent for combining MAP and FLATTEN. FIRST_ITEM(array: Array<X>) => X Returns the first item in the given array (or undefined if the array is empty) LAST_ITEM(array: Array<X>) => X Returns the last item in the given array (or undefined if the array is empty)
1
Load More