November: Procrastination Month
    Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »

    urlpatternpublic

    urlpattern

    Parse and transform URL patterns.

    Install

    $ npm install urlpattern
    

    Usage

    Express-style Patterns

    Parse a pattern into a RegExp, and its constituent placeholders.

    var pattern = require('urlpattern').express;
     
    var placeholders = [];
    var regexp = pattern.parse('/user/:id', placeholders);

    Subsitute variables into a pattern.

    var pattern = require('urlpattern').express;
     
    pattern.transform('/user/:id', { id: '1234' });
    // => '/user/1234'

    Tests

    $ npm install
    $ npm test
    

    Build Status

    Credits

    License

    The MIT License

    Copyright (c) 2013 Jared Hanson <http://jaredhanson.net/>

    Keywords

    none

    install

    npm i urlpattern

    Downloadsweekly downloads

    109

    version

    0.1.0

    license

    none

    repository

    githubgithub

    last publish

    collaborators

    • avatar