Module: nupp.io.URI

Parsing and inspection operations for immutable absolute URIs.

Module contents

Constructors

ConstructorDescription
newParses and normalizes an absolute URI.

Functions

FunctionKindDescription
isURIfunctionReports whether a value is a URI object.
validatefunctionChecks whether text is a valid absolute URI without retaining an object.

Constructors#

newconstructor#

Parses and normalizes an absolute URI.

local new: function(value: string | Components): (URI?, string?)

Arguments

NameTypeDescription
valuestring | Components

URI text or its individual components

Returns

TypeDescription
URI?

the parsed URI, or nil on failure

string?

a failure reason, when unsuccessful

Functions#

isURIfunction#

Reports whether a value is a URI object.

local isURI: function(value: any): boolean

Arguments

NameTypeDescription
valueany

the value to inspect

Returns

TypeDescription
boolean

whether the value is a URI

validatefunction#

Checks whether text is a valid absolute URI without retaining an object.

local validate: function(text: string): (boolean, string?)

Arguments

NameTypeDescription
textstring

the URI text to validate

Returns

TypeDescription
boolean

whether the text is valid

string?

a failure reason, when invalid