url-escape-tag

A template tag for escaping url parameters based on ES2015 tagged templates.

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
url-escape-tag
1401.0.07 years ago7 years agoMinified + gzip package size for url-escape-tag in KB

Readme

url-escape-tag
A template tag for escaping url parameters based on ES2015 tagged templates.
Internally, this package uses node.js querystring.escape, a safer implementation of encodeURIComponent.

Status

!npm versionnpm-imagenpm-url !build statustravis-imagetravis-url

Installation

Install the package via npm:
npm install url-escape-tag --save

Usage

Arguments

  1. url (string): The url with parameters to escape.

Returns

(string): The url with parameters escaped.

Example

const esc = require('url-escape-tag');
const foo = '../foo';
const bar = '+bar';

console.log(esc`/${foo}?field1=${bar}`);
// => /..%2Ffoo?field1=%2Bbar

Tests

npm test

Release

npm version [<newversion> | major | minor | patch] -m "Release %s"

License

MIT