JSPM

interpolate-url

0.0.2
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 9
  • Score
    100M100P100Q37195F
  • License MIT

Interpolate urls containing /:colon variables

Package Exports

  • interpolate-url

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (interpolate-url) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

interpolate-url

Build Status

Basic api to do url interpolation using colons as the delimiter.

var interpolateUrl = require('interpolate-url');

var url = interpolateUrl('http://google.com/user/:id', {id: 10});

// url => http://google.com/user/10

var url = interpolateUrl('http://google.com/:type/:id', {type: 'car', id: 10});

// url => http://google.com/car/id

Also allows partial interpolation:

var url = interpolateUrl('http://google.com/:type/:id', {id: 10});

// url => http://google.com/:type/id