up

url_parser

Helper to parse url that works seamlessly across Node.js and browser environments

Showing:

Popularity

Downloads/wk

29

GitHub Stars

4

Maintenance

Last Commit

5yrs ago

Contributors

2

Package

Dependencies

1

Size (min+gzip)

22.7KB

License

MIT

Type Definitions

Tree-Shakeable

No?

Categories

Readme

URL Parser

NPM Version NPM Downloads Coverage Status Build Status

Server

Installation

npm install url_parser

Usage

var urlParser = require('url_parser');

urlParser('http://example.com/terms/:termId/posts/:postId', {
    termId: 1,
    postId: 2,
}); // -> http://example.com/terms/1/posts/2
var urlParser = require('url_parser');

urlParser('http://example.com/terms/:termId/posts', {
    termId: 1,
    skip: 5,
    take: 10,
}); // -> http://example.com/terms/1/posts?skip=5&take=10

Client

Installation

bower install url_parser

Usage

In HTML:

<script src="bower_components/url_parser/dist/url-parser.standalone.min.js"></script>

In Javascript:

var url = urlParser('http://example.com/terms/:termId/posts/:postId', {
    termId: 1,
    postId: 2,
});

console.log(url); // -> http://example.com/terms/1/posts/2
var url = urlParser('http://example.com/terms/:termId/posts', {
    termId: 1,
    skip: 5,
    take: 10,
});

console.log(url); // -> http://example.com/terms/1/posts?skip=5&take=10

Tests

$ npm install
$ npm test

License

The MIT License

Rate & Review

Great Documentation0
Easy to Use0
Performant0
Highly Customizable0
Bleeding Edge0
Responsive Maintainers0
Poor Documentation0
Hard to Use0
Slow0
Buggy0
Abandoned0
Unwelcoming Community0
100