Open Noitidart opened 7 years ago
@Noitidart I'll look into it as I'm using this a lot too. I actually planned to (some day) implement an object-sorting mechanism that actually detects objects. I guess that'd fix part of this issue.
in my js objects I have a space between the colon
{z: true, b: false} => {b: false, z: true}
Works for me. What's the part you don't expect?
v0.1.3
should properly sort inline CSS. Let me know if there's anything unexpected happening.
v0.1.4
sorts b="B" a="A"
to a="A" b="B"
v0.1.8
sorts style="top: 1px; bottom: 2px;" a="test"
to a="test" style="top: 1px; bottom: 2px;"
Thank you sir so much!! You thought of common cases that I didn't even consider! Too great! :)
v1.0.0
should sort JSON properly. Doesn't work for plain objects though. :/
Thank you sooo much for keeping us updated, especially the to do style task list you edited into the OP. JSON sorting is so awesome! Just tested it!
This is just such an awesome plugin. Thank you for it. I use it regularly to sort keys in javascript objects:
But I was hoping to use it on html attributes as well, but it splits on the
=
so it doesnt work. Is it possible to make it not split on=
?Like:
Should sort to:
Also some time in my js objects I have a space between the colon so like this:
And this fails to sort, is it possible to ignore the first space after a colon?
Example of inline css:
A regex split that would work for this is
/\:\w*/
or for equals sign:/\=\w*/