NLdoc.Util.StringFormat (NLdoc.Util v1.0.7)

View Source

Checks if is uri or path

Summary

Functions

Converts a map or struct to a map with different keys.

Functions

uri?(value)

@spec uri?(String.t()) :: boolean()
@spec uri?(URI.t()) :: boolean()

Converts a map or struct to a map with different keys.

Examples

With string values:

iex> NLdoc.Util.StringFormat.uri?("https://example.com/123")
true
iex> NLdoc.Util.StringFormat.uri?("media/image.png")
false
iex> NLdoc.Util.StringFormat.uri?("ftp://example.com/123")
true

Or with parsed URI's:

iex> NLdoc.Util.StringFormat.uri?(%URI{path: "media/image.png"})
false
iex> NLdoc.Util.StringFormat.uri?(%URI{scheme: "http", host: "example.com", path: "/media/image.png"})
true