mirror of
https://github.com/dzeiocom/libs.git
synced 2025-06-26 17:29:19 +00:00
Updated objectSort to support an Array containing a specific order
Signed-off-by: Avior <florian.bouillon@delta-wings.net>
This commit is contained in:
@ -53,6 +53,10 @@ objectSize(object)
|
||||
// like Array.sort it sort and return an ordered object
|
||||
objectSort(object, /*optionnal*/ (key1, key2) => key1 - key2)
|
||||
|
||||
// You can also sort by keys
|
||||
// items not set in the array won't have their order changed and will be after the sorted ones
|
||||
objectSort(object, ['key2', 'key1']) // => {key2: value, key1: value, key3: value}
|
||||
|
||||
// deeply clone an object
|
||||
cloneObject(object)
|
||||
|
||||
|
Reference in New Issue
Block a user