urla
TypeScript icon, indicating that this package has built-in type declarations

0.0.4 • Public • Published

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.

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 0.0.4
    1
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 0.0.4
    1
  • 0.0.3
    0
  • 0.0.2
    0
  • 0.0.1
    0

Package Sidebar

Install

npm i urla

Weekly Downloads

1

Version

0.0.4

License

MIT

Unpacked Size

15.6 kB

Total Files

24

Last publish

Collaborators

  • amogower