cloneKeySort
Copy a value while sorting its keys.
cloneKeySort(value)
cloneKeySort
returns a copy of value
with its isMapLike
key values sorted. If you just want a copy of a value,
use serialize.
import canRefect from "can-reflect";
canReflect.cloneKeySort({z: "Z", a: "A"}) //-> {a:"A",z:"Z"}
Nested objects are also sorted.
This is useful if you need to store a representation of an object that can be used as a key.
Parameters
- value
{Object}
:An object or array.
Returns
{Object}
:
A copy of the object with its keys sorted.