yarn_parser v0.3.1 YarnParser View Source
A parser for Yarn lock files
Link to this section Summary
Functions
Parses a lock file
Encodes a map into a yarn lockfile format
Extracts the version from the comments on a parsed lockfile
Link to this section Functions
Specs
Parses a lock file
Examples
iex> input =
...> """
...> prop1 val1
...> block1:
...> prop2 true
...> prop3 123
...> """
iex> YarnParser.decode(input)
{:ok, %{
"prop1" => "val1",
"block1" => %{
"prop2" => true
},
"prop3" => 123
}}
Specs
Encodes a map into a yarn lockfile format
Options
:version
The yarn lockfile version. Defaults to1
.:no_header
If true, it skips header comments. Defaults tofalse
.
Examples
iex> map = %{"prop1" => 1,"block1" => %{"prop2" => true}}
iex> YarnParser.encode(map, no_header: true)
"block1:\n prop2 true\n\nprop1 1"
Specs
Extracts the version from the comments on a parsed lockfile