1.0.0 • Published 6 years ago
build-uri-path v1.0.0
build-uri-path
This is the accompanying source code for the blog post Reduce, Reuse, React published for JavaScript January.
TL;DR
- Reliably build a Uri path
- Use as a Tagged Template Literal function
Install
$ npm i --save build-uri-path
Usage
import buildUriPath from 'build-uri-path';
const resource = 'topic';
const id = 'form/function';
const path = buildUriPath`/${resource}/${id}`;
In this example, path
would equal "/topic/form%2Ffunction/"