json-minify 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6ca223097ab556986fe54fba09c40c6daf3654f9
4
- data.tar.gz: 375b20f9d9cc35fb3bb55329d1eac9251e7a20f0
3
+ metadata.gz: aeb41b79a66fbd6809e151954d72c477f243ddc8
4
+ data.tar.gz: 485ae54778599198f619d9900c5a340eb877fb96
5
5
  SHA512:
6
- metadata.gz: d94e03273a9b097d6f4d8fb06c85bceb4ba9fe5099c0bdc9194cab7638c6c98bee6b6745c5d0d28962c2a74e39792c965b33428b3a167637dc0cd4242ff6a2b1
7
- data.tar.gz: f05dc098243c5345af7076d82b76d1363d3b936333b2262a47d1bccd73109e6f46036c8eafab26c47837d5f31cb4e6aebd09cefac473449d1c01b8d1a96d2615
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
@@ -19,7 +19,7 @@ module JSON
19
19
  buf << s
20
20
 
21
21
  # Scan strings
22
- elsif s = ss.scan(/"(.*?[^\\])?"/)
22
+ elsif s = ss.scan(/""|(".*?[^\\])?"/)
23
23
  buf << s
24
24
 
25
25
  # Scan reserved words
@@ -1,5 +1,5 @@
1
1
  module JSON
2
2
  module Minify
3
- VERSION = "0.0.1"
3
+ VERSION = "0.0.2"
4
4
  end
5
5
  end
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.1
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-02-26 00:00:00.000000000 Z
14
+ date: 2014-08-14 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: bundler