1
0
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:
2021-04-11 00:34:14 +02:00
parent 485e3b7b36
commit 76e2263812
3 changed files with 29 additions and 5 deletions

View File

@ -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)