]> git.r.bdr.sh - rbdr/dotfiles/blame_incremental - atom/packages/pretty-json/node_modules/jsonminify/README.md
Remove powerline config
[rbdr/dotfiles] / atom / packages / pretty-json / node_modules / jsonminify / README.md
... / ...
CommitLineData
1# About
2
3![Travis CI](https://travis-ci.org/fkei/JSON.minify.png?branch=master)
4
5
6# Feature
7
8/*! JSON.minify()
9 v0.1 (c) Kyle Simpson
10 MIT License
11*/
12
13JSON.minify() minifies blocks of JSON-like content into valid JSON by removing all
14whitespace *and* comments.
15
16JSON parsers (like JavaScript's JSON.parse() parser) generally don't consider JSON
17with comments to be valid and parseable. So, the intended usage is to minify
18development-friendly JSON (with comments) to valid JSON before parsing, such as:
19
20JSON.parse(JSON.minify(str));
21
22Now you can maintain development-friendly JSON documents, but minify them before
23parsing or before transmitting them over-the-wire.
24
25Though comments are not officially part of the JSON standard, this post from
26Douglas Crockford back in late 2005 helps explain the motivation behind this project.
27
28http://tech.groups.yahoo.com/group/json/message/152
29
30"A JSON encoder MUST NOT output comments. A JSON decoder MAY accept and ignore comments."
31
32Basically, comments are not in the JSON *generation* standard, but that doesn't mean
33that a parser can't be taught to ignore them. Which is exactly what JSON.minify()
34is for.
35
36The first implementation of JSON.minify() is in JavaScript, but the intent is to
37port the implementation to as many other environments as possible/practical.
38
39NOTE: As transmitting bloated (ie, with comments/whitespace) JSON would be wasteful
40and silly, this JSON.minify() is intended for use in server-side processing
41environments where you can strip comments/whitespace from JSON before parsing
42a JSON document, or before transmitting such over-the-wire from server to browser.
43
44# install
45
46## npm repo
47
48```
49$ npm install jsonminify
50```
51
52## npm source
53
54```
55$ npm install https://github.com/fkei/JSON.minify.git
56```
57
58# example
59
60
61```javascript
62var jsonminify = require("jsonminify");
63
64jsonminify('{"key":"value"/** comment **/}')
65>> '{"key":"value"}'
66
67JSON.minify('{"key":"value"/** comment **/}')
68>> '{"key":"value"}'
69```
70
71# command-line
72
73Please use here. Use JSON.minify internally.
74
75**node-mjson** [https://github.com/fkei/node-mjson](https://github.com/fkei/node-mjson)
76
77
78# build
79
80```
81$ make
82```
83
84# release
85
86```
87$ make release
88```
89
90# test
91
92```
93$ make test
94```
95
96# jshint
97
98```
99$ make jshint
100```
101
102# Document
103
104- [JSDoc - API Document](http://fkei.github.io/JSON.minify/docs/index.html)
105- [Plato - Report](http://fkei.github.io/JSON.minify/report/index.html)
106- [Mocha - Test result (HTML)](http://fkei.github.io/JSON.minify/TestDoc.html)
107
108# Web-Site
109
110**[Github pages - JSON.minify Home Page](http://fkei.github.io/JSON.minify/)**
111
112# LICENSE
113
114forked from [getify/JSON.minify](https://github.com/getify/JSON.minify)
115
116```
117The MIT License (MIT)
118
119Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
120
121The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
122
123THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
124```