http://rlidwka.github.io/jju/editor.html

It's just a demo that shows how a computer can edit json files while preserving 
formatting of the source. Editor itself is pretty useless as is though.

So the issue I'm trying to solve is this: A lot of programs store their config 
files in JSON/CJSON format nowadays. Sadly, a common way to change something in 
the existing format (think about version bump or a genuine GUI editor), is to 
overwrite the entire file with the default formatting.

Since formatting is extremely important for any file maintained by a human, I 
thought it's about time to do something about it. So I've been developing this 
general-purpose library for the last few months:

https://github.com/rlidwka/jju

The idea is to allow a javascript interpreter to edit config files in-place 
just like a human would do.

With this library if you want to edit a config file, you simply run an update() 
function, pass old json string and a new object you want to write there, and 
get a new config that as close to the original one as possible:

> require('jju').update('{/* comment */ "foo": "bar"}', {foo: "quux"})
'{/* comment */ "foo": "quux"}'

Supported formats are: JSON, CJSON, JSON5. I'd point out that YAML is superiour 
for config files, but in this particular case it turned out to be too complex. 
If anybody knows how to do similar thing with YAML, I really want to know about 
it.


--
Regards,
alex

-- 
-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

--- 
You received this message because you are subscribed to the Google Groups 
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to