BitwiseIp.Blocks.parse

You're seeing just the function parse, go back to BitwiseIp.Blocks module for more information.

Specs

parse([String.t()]) :: t()

Parses a list of strings into bitwise IP blocks.

This function takes a list of strings in CIDR notation and parses them into bitwise IP blocks using BitwiseIp.Block.parse/1. If a string is invalid, its value is discarded from the resulting list. If you want to raise an error instead, use parse!/1.

Examples

iex> BitwiseIp.Blocks.parse(["3.14.0.0/16", "dead::beef"])
...> |> Enum.map(&to_string/1)
["3.14.0.0/16", "dead::beef/128"]

iex> BitwiseIp.Blocks.parse(["3.14/16", "invalid", "dead::cow"])
[]

iex> BitwiseIp.Blocks.parse(["3.14.0.0/16", "invalid", "dead::beef"])
...> |> Enum.map(&to_string/1)
["3.14.0.0/16", "dead::beef/128"]