json-minify 0.0.1 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +13 -11
- data/lib/json/minify.rb +1 -1
- data/lib/json/minify/version.rb +1 -1
- data/spec/minify_spec.rb +10 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: aeb41b79a66fbd6809e151954d72c477f243ddc8
|
4
|
+
data.tar.gz: 485ae54778599198f619d9900c5a340eb877fb96
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 94daa535c56dd78b04aed9fe637bbe3c8faa44dc450970930b082a05c92a89e713277d822fa708674645a1321123b9968f8980f7f0078422881ca92273e0bbeb
|
7
|
+
data.tar.gz: 8c5da8da575610179c06955fa2cc9dad8119d3954b007c836b8524e03b34326aef2d118004b790d34412af8afc6798f787f46c9047762cb2f97fbe27bab3b707
|
data/README.md
CHANGED
@@ -1,6 +1,18 @@
|
|
1
1
|
# JSON::Minify
|
2
2
|
|
3
|
-
JSON.minify implementation
|
3
|
+
JSON.minify implementation - rationale is here: https://github.com/getify/JSON.minify
|
4
|
+
|
5
|
+
> Though comments are not officially part of the JSON standard, this post from
|
6
|
+
> Douglas Crockford back in late 2005 helps explain the motivation behind this project.
|
7
|
+
>
|
8
|
+
> http://tech.groups.yahoo.com/group/json/message/152
|
9
|
+
>
|
10
|
+
> "A JSON encoder MUST NOT output comments. A JSON decoder MAY accept and ignore comments."
|
11
|
+
|
12
|
+
## Credits
|
13
|
+
|
14
|
+
- Matthew O'Riordan github.com/mattheworiordan - fix for handling empty strings
|
15
|
+
(in v0.0.2)
|
4
16
|
|
5
17
|
## Installation
|
6
18
|
|
@@ -18,16 +30,6 @@ Or install it yourself as:
|
|
18
30
|
|
19
31
|
## Usage
|
20
32
|
|
21
|
-
Rationale is here: https://github.com/getify/JSON.minify
|
22
|
-
|
23
|
-
Though comments are not officially part of the JSON standard, this post from
|
24
|
-
Douglas Crockford back in late 2005 helps explain the motivation behind this project.
|
25
|
-
|
26
|
-
http://tech.groups.yahoo.com/group/json/message/152
|
27
|
-
|
28
|
-
"A JSON encoder MUST NOT output comments. A JSON decoder MAY accept and ignore comments."
|
29
|
-
|
30
|
-
|
31
33
|
API is compatible with JSON.minify in the npm node-json-minify package.
|
32
34
|
|
33
35
|
JSON.minify("{ }") #=> "{}"
|
data/lib/json/minify.rb
CHANGED
data/lib/json/minify/version.rb
CHANGED
data/spec/minify_spec.rb
CHANGED
@@ -21,4 +21,14 @@ describe JSON::Minify do
|
|
21
21
|
it "should cope with the example from https://github.com/getify/JSON.minify" do
|
22
22
|
expect(JSON.minify( %Q'{ /* comment */ "foo": 42 \n }' )).to eql('{"foo":42}')
|
23
23
|
end
|
24
|
+
|
25
|
+
it "should cope with the https://gist.github.com/mattheworiordan/72db0dfc933f743622eb" do
|
26
|
+
expect(JSON.minify('{ "PolicyName": { "Fn::Join" : [ "", [ "AblySnsPublish-", { "Ref" : "AWS::Region" }, "-", { "Ref" : "DataCenterID" } ] ] } }')).to \
|
27
|
+
eql('{"PolicyName":{"Fn::Join":["",["AblySnsPublish-",{"Ref":"AWS::Region"},"-",{"Ref":"DataCenterID"}]]}}')
|
28
|
+
end
|
29
|
+
|
30
|
+
it "should cope with escaped double quoted strings" do
|
31
|
+
expect(JSON.minify('{ "Statement1": "he said \"no way\" to the dog", "Statement2": "she said \"really?\"" }')).to \
|
32
|
+
eql('{"Statement1":"he said \"no way\" to the dog","Statement2":"she said \"really?\""}')
|
33
|
+
end
|
24
34
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: json-minify
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- |+
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date: 2014-
|
14
|
+
date: 2014-08-14 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: bundler
|