getify / JSON.minify

Simple minifier for JSON to remove comments and whitespace
http://web.archive.org/web/20100629021329/http://blog.getify.com/2010/06/json-comments/
410 stars 102 forks source link

Node port: export as UMD to support use in code #50

Closed peacechen closed 5 years ago

peacechen commented 5 years ago

It would be great for this library to use UMD, allowing support for Node, browser and script injection. For example, I'd like to use it in code like this:

var jsonMinify = require("node-json-minify");

// someJSONstring is a string in JSON format
let realJSON = jsonMinify(someJSONstring);
getify commented 5 years ago

There is a node port using commonjs: https://github.com/getify/JSON.minify/tree/node

And there's a standard .js file port for use in browsers: https://github.com/getify/JSON.minify/tree/javascript

Not sure of there being a benefit to a single UMD format when both those already exist.

peacechen commented 5 years ago

That should do the job. It would reduce maintenance to publish one package that can run on Node, browser module, or script injection (plus AMD). Fewer merges to the multiple branches that aren't really necessary when the core code is identical.