Clear and concise description of the problem
Add sorting for items in Map and Array.
Suggested solution
Support for Strings in Arrays
If there is support for objects in arrays, I believe it is also necessary to support strings in arrays.
Before implementation
// @keep-sorted
const arr = [
`b`,
`a`,
`c`,
]
After implementation
// @keep-sorted
const arr = [
`a`,
`b`,
`c`,
]
Currently, I can only use it like this
// @keep-sorted
const arr = objToArr({
b: true,
a: true,
c: true,
})
Support for Map
Before
// @keep-sorted
const map = new Map([
[`c`, `cc`],
[`a`, `aa`],
])
After
// @keep-sorted
const map = new Map([
[`a`, `aa`],
[`c`, `cc`],
])
Adjust Sorting Rules
Expect the order a before a.b, rather than after, using ASCII ascending order.
Current Sorting
// @keep-sorted
const obj = {
'a.1': true,
'a': true,
'b': true,
'c': true,
}
Expected Sorting
// @keep-sorted
const obj = {
'a': true,
'a.1': true,
'a.2': true,
'b': true,
'c': true,
}
If it conflicts with the currently implemented sorting method, could sorting be supported as a parameter?
Alternative
No response
Additional context
No response
Validations
Clear and concise description of the problem
Add sorting for items in Map and Array.
Suggested solution
Support for Strings in Arrays
If there is support for objects in arrays, I believe it is also necessary to support strings in arrays.
Before implementation
After implementation
Currently, I can only use it like this
Support for Map
Before
After
Adjust Sorting Rules
Expect the order
abeforea.b, rather than after, using ASCII ascending order.Current Sorting
Expected Sorting
If it conflicts with the currently implemented sorting method, could sorting be supported as a parameter?
Alternative
No response
Additional context
No response
Validations