5.0.0 • Published 8 months ago

@288-toolkit/url v5.0.0

Weekly downloads
-
License
MIT
Repository
-
Last release
8 months ago

Url

npm i @288-toolkit/url

A collection of functions to work with urls.

isExternalUrl()

Check if a URL is external.

validateSameOrigin()

Validate if the URL is from the same origin as the request URL.

createEntryUrlBuilder

Creates a function that builds URLs for entries.

const getEntryUrl = createEntryUrlBuilder({
	localize: true,
	siteUrl: 'https://example.org',
	homeUri: '__home__'
});

getEntryUrl(mockEntry).raw; // The URL object.
getEntryUrl(mockEntry).toAbsolute(); // Returns the full URL string.
getEntryUrl(mockEntry).toString(); // Returns the full URL string.
getEntryUrl(mockEntry).toSchemeLess(); // Returns the URL string without the scheme, composed of the pathname, search, and hash.
getEntryUrl(mockEntry).toLanguageRelative(); // Returns the entry uri relative to the language.
5.0.0

8 months ago

4.1.4

10 months ago

4.1.3

10 months ago

4.1.2

1 year ago

4.1.0

1 year ago

4.1.1

1 year ago

4.0.0

1 year ago

3.0.0

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago