eins78 / atom-transform

Transform (selected) text in @atom editor.
MIT License
10 stars 1 forks source link

Request: Can add custom transformations #9

Open ghost opened 7 years ago

ghost commented 7 years ago

Quite a cool plugin you've made, by the sounds of it. Sometimes I've needed one or 2 of these transformations.

Adding the ability for users to add custom transformations would make it really useful.

I'd like to be able to create my own transformations with just a name for the function, and then I can provide a function that takes an array of strings (the selections) and outputs an array of strings (transformed)

What I immediately have in mind to make

Input

{
 "a": 1, //double quotes around keys, necessary for JSON but hurts readability in JS
 "b": 2,
 "c-d-e": 3
}

Output

{
 a: 1, //unnecessary quotes removed
 b: 2,
 'c-d-e': 3 //single quotes are cleaner to look at than double quotes, more readable
}