0.0.4 • Published 5 years ago

urla v0.0.4

Weekly downloads
5
License
MIT
Repository
github
Last release
5 years ago

urla

Easy url manipulation in the browser.

Documentation

queryString(name: string, encoded?: boolean): string | boolean | undefined

Finds the value of parameter passed in first argument.

parseQuery(search: string): object

Parses a string as querystring. Like the queryString method does, if the parameter is there, but it doesn't have a value, the value will be true.

stringify(queryObj: object): string

Stringifies a query object.

updateSearchParam(param: string | object, value: string | undefined, push: boolean = true, triggerPopState: boolean = false): void

Adds, updates or deletes a parameter (without page refresh). If value argument is undefined, the parameter will be removed.

getLocation(): string

Returns the page url (without domain name).

hash(newHash: string, triggerPopState: boolean = false): string

Gets/sets the hash value.

_urlOverwrite(str: string, push: boolean = true, triggerPopState: boolean = false): string

Update the full url (pathname, search, hash).

getLocation(pathname: string, push: boolean = true, triggerPopState: boolean = false): string

Gets/sets the pathname.

triggerPopStateCb()

Calls the popstate handlers.

onPopState(cb: (...args: any[]) => void)

Adds a popstate handler.

removeHash(push: boolean = true, trigger: boolean = false)

Removes the hash from the url.

removeQuery(push: boolean = true, trigger: boolean = false)

Removes the querystring parameters from the url.

0.0.4

5 years ago

0.0.3

5 years ago

0.0.2

5 years ago

0.0.1

5 years ago