generate-clean-url
v3.0.3
Published
Generate a URL from base URL and given parameters
Downloads
7
Readme
generate-clean-url
generate-clean-url is a single method package for constructing a URL from component parts and getting the constructed string. This package is ideal for safely fail-safe constricting of URLs in back-end environment.
Features
- Special characters encoding.
- Skipping undefined or empty query parameter strings.
Installing
Using npm:
npm install generate-clean-url
Using yarn:
yarn add generate-clean-url
Importing
CJS:
const generateUrl = require('generate-clean-url');
EMS:
import generateUrl from 'generate-clean-url';
Using
const baseUrl = "http://testurl.bitfinx.com/";
const params = {
width: 360,
height: 300,
locale: 'en',
toolbar_bg: '',
interval: '3h',
pair: 'BTC_USD'
};
const url = generateUrl(baseUrl, params);