@firecamp/url
TypeScript icon, indicating that this package has built-in type declarations

0.0.20 • Public • Published

URL Utility

Usage

Update URL on update raw string

import _url from '@firecamp/url'

// parse query, path params from raw URL and return URL Object
// with updated params table
state.urlObj = _url.updateByRaw(state.urlObj)

Update URL on update query from table

import _url from '@firecamp/url'

// Return URL object by updating query into raw URL from table
const { raw } = _url.updateByQuery(state.urlObj)

// Update raw URL into state
state.urlObj.raw = raw

Parse URL

import _url from '@firecamp/url'

// Parse URL string, require at the time of request execution
_url.parse('google.com', ['http', 'https])

// return http://google.com

Replace Path Params value

import _url from '@firecamp/url'

// Parse URL string, require at the time of request execution
_url.replacePathParams('http://localhost:3000/:id', [{ key: 'id', value: '1' }])

// return http://localhost:3000/1

Readme

Keywords

none

Package Sidebar

Install

npm i @firecamp/url

Weekly Downloads

12

Version

0.0.20

License

Apache-2.0

Unpacked Size

79 kB

Total Files

35

Last publish

Collaborators

  • nishchit14