Create a URL in a simple human readable way.
JavaScript
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
test
.gitignore
README.md
index.js
package.json

README.md

create-url

Create a URL/path in a simple human readable way.

browser support

Install

Install the npm package and use browserify or a simular tool to compile.

npm install https://github.com/orangemug/create-url.git

Usage

Any object keys not in the template URL will get added as params.

var createURL = require("create-url");
createURL("/path/{id}?index=3#section-{sectionNum}", {
  id: "badger",
  ref: "mushroom",
  sectionNum: 1
}); // => "/path/badger?index=3&ref=mushroom#section-1"

See tests for more examples.

License

MIT