Docs
/
data
Data
A collection of functions for formatting, filtering and taming wild arrays and objects.
dataSortBy
Link Copied!
Sort an array or object by a property.
[ { "name": "Keith Richards", "age": 77 }, { "name": "Mick Jagger", "age": 78 }, { "name": "Charlie Watts", "age": 80 } ]
dataSortBy([{"name":"Keith Richards","age":77},{"name":"Mick Jagger","age":78},{"name":"Charlie Watts","age":80}], { property: 'name', order: 'asc' })
[
{
"name": "Charlie Watts",
"age": 80
},
{
"name": "Keith Richards",
"age": 77
},
{
"name": "Mick Jagger",
"age": 78
}
]
Result
dataSortBy(items: object | string[] | number[], options?: { property?: string; order?: 'asc' | 'desc' })
dataReverse
Link Copied!
Reverse an array or object.
[ "s", "c", "o", "o", "t", "e", "r" ]
[
"r",
"e",
"t",
"o",
"o",
"c",
"s"
]
Result
dataReverse(items: object | string[] | number[])
dataFlatten
Link Copied!
Returns single unique values within an array or object
[ "s", [ "c", "o" ], [ "o", "t" ], [ "e", "r" ] ]
[
"s",
"c",
"o",
"o",
"t",
"e",
"r"
]
Result
dataFlatten(items: object | any[])
dataWithout
Link Copied!
Returns an array without a property or properties.
{ "name": "John", "age": 25, "address": { "street": "123 Main St", "city": "Springfield", "state": "IL" }, "country": "USA" }
dataWithout({"name":"John","age":25,"address":{"street":"123 Main St","city":"Springfield","state":"IL"},"country":"USA"}, 'address')
{
"name": "John",
"age": 25,
"country": "USA"
}
Result
dataWithout(items: object | string[] | number[], properties: string | number | string[] | number[])