Current section
11 Versions
Jump to
Current section
11 Versions
Compare versions
6
files changed
+19
additions
-7
deletions
| @@ -9,9 +9,9 @@ The package can be installed by adding `jsonc` to your list of dependencies in ` | |
| 9 9 | ```elixir |
| 10 10 | def deps do |
| 11 11 | [ |
| 12 | - {:jsonc, "~> 0.2.1"} |
| 12 | + {:jsonc, "~> 0.2.2"} |
| 13 13 | ] |
| 14 14 | end |
| 15 15 | ``` |
| 16 16 | |
| 17 | - Documentation can be found at https://hexdocs.pm/jsonc |
| \ No newline at end of file | |
| 17 | + Documentation can be found at https://hexdocs.pm/jsonc |
| @@ -3,8 +3,8 @@ | |
| 3 3 | {<<"description">>,<<"utilities to work with jsonc, a superset of json">>}. |
| 4 4 | {<<"elixir">>,<<"~> 1.13">>}. |
| 5 5 | {<<"files">>, |
| 6 | - [<<"lib">>,<<"lib/tokenizer.ex">>,<<"lib/parser.ex">>,<<"lib/decoder.ex">>, |
| 7 | - <<"lib/transcoder.ex">>,<<"lib/jsonc.ex">>,<<"mix.exs">>,<<"README.md">>, |
| 6 | + [<<"lib">>,<<"lib/decoder.ex">>,<<"lib/transcoder.ex">>,<<"lib/jsonc.ex">>, |
| 7 | + <<"lib/parser.ex">>,<<"lib/tokenizer.ex">>,<<"mix.exs">>,<<"README.md">>, |
| 8 8 | <<"LICENSE">>]}. |
| 9 9 | {<<"licenses">>,[<<"Apache-2.0">>]}. |
| 10 10 | {<<"links">>, |
| @@ -12,4 +12,4 @@ | |
| 12 12 | {<<"jsonc">>,<<"https://komkom.github.io/jsonc-playground">>}]}. |
| 13 13 | {<<"name">>,<<"jsonc">>}. |
| 14 14 | {<<"requirements">>,[]}. |
| 15 | - {<<"version">>,<<"0.2.1">>}. |
| 15 | + {<<"version">>,<<"0.2.2">>}. |
| @@ -1,6 +1,9 @@ | |
| 1 1 | defmodule JSONC.Decoder do |
| 2 2 | import JSONC.Parser |
| 3 3 | |
| 4 | + @doc """ |
| 5 | + decodes a jsonc document into a map and raises in case of error |
| 6 | + """ |
| 4 7 | def decode!(content) when is_binary(content) do |
| 5 8 | case decode(content) do |
| 6 9 | {:ok, result} -> result |
| @@ -8,6 +11,9 @@ defmodule JSONC.Decoder do | |
| 8 11 | end |
| 9 12 | end |
| 10 13 | |
| 14 | + @doc """ |
| 15 | + decodes a jsonc document into a map |
| 16 | + """ |
| 11 17 | def decode(content) when is_binary(content) do |
| 12 18 | case parse(content) do |
| 13 19 | {:ok, %{type: :root, value: value}} -> |
| @@ -39,7 +39,7 @@ defmodule JSONC do | |
| 39 39 | ``` |
| 40 40 | defp deps do |
| 41 41 | [ |
| 42 | - {:jsonc, "~> 0.2.1"} |
| 42 | + {:jsonc, "~> 0.2.2"} |
| 43 43 | ] |
| 44 44 | end |
| 45 45 | ``` |
| @@ -1,6 +1,9 @@ | |
| 1 1 | defmodule JSONC.Transcoder do |
| 2 2 | import JSONC.Parser |
| 3 3 | |
| 4 | + @doc """ |
| 5 | + transcodes a jsonc document into a json document and raises in case of error |
| 6 | + """ |
| 4 7 | def transcode!(content) when is_binary(content) do |
| 5 8 | case transcode(content) do |
| 6 9 | {:ok, result} -> result |
| @@ -8,6 +11,9 @@ defmodule JSONC.Transcoder do | |
| 8 11 | end |
| 9 12 | end |
| 10 13 | |
| 14 | + @doc """ |
| 15 | + transcodes a jsonc document into a json document |
| 16 | + """ |
| 11 17 | def transcode(content) when is_binary(content) do |
| 12 18 | case parse(content) do |
| 13 19 | {:ok, %{type: :root, value: value}} -> |
Loading more files…