Open
Description
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
- Follow our Code of Conduct
- Read the Contributing Guide.
- Check that there isn't already an issue that request the same feature to avoid creating a duplicate.