Powered By GitBook
REMOVE_ITEM_BY_KEY
Remove objects from list by a key

Description

Finds an object by a key-value pair and returns a list which doesn't contain the matched object.
For example, given Key "id" and Value 123, will return a list without the object whose id property is 123.
If a matching object cannot be found, the original list is returned unmodified.

Function signature

1
REMOVE_ITEM_BY_KEY(list: Array, key: String, value: ) => Array
Copied!
Parameter
Description
List
List to remove object from
Key
Key whose value to match
Value
Value to match

Examples

1
array1 = [{"a":1},{"a":2},{"a":3}]
2
array2 = [{"a":3},{"a":{"b":10}}]
3
array3 = [{"a":3},{"a":2}]
Copied!
Formula
Return value
REMOVE_ITEM_BY_KEY(array1, "a", 2)
[{"a":1},{"a":3}]
REMOVE_ITEM_BY_KEY(array2, "a", { b: 10 })
[{"a":3}]
REMOVE_ITEM_BY_KEY(array3, "a", 4)
[{"a":3},{"a":2}]
Last modified 11mo ago
Export as PDF
Copy link