1.0.0 • Published 6 years ago

build-uri-path v1.0.0

Weekly downloads
4
License
MIT
Repository
github
Last release
6 years ago

build-uri-path

Build Status npm version Coverage Status

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/"