2.1.1 • Published 6 years ago

path-pattern v2.1.1

Weekly downloads
7
License
MIT
Repository
github
Last release
6 years ago

This package might contain a few bugs

Even if we use this package in production at Realytics and it is quite well tested, we can't garanty it won't break. If you want to use this, do it carefully and feel free to report issue so we can improve it 😉.

Prerequisites

You need NodeJS and NPM or Yarn to install this package.

Installing

yarn add path-pattern or npm install path-pattern --save

Motivations

This package is inspired from the match function from React Router. The main difference is that you don't have to pass the path everytime, instead you just create a "pattern" once and use it everywhere you need.

Import in your project

ES6 or Typescript

Note : If you use Typescript, typings are include in the package !

import { createPattern } from 'path-pattern';

Node

const PathPattern = require('path-pattern').PathPattern;

Some examples

// A basic route
const userRoute = new PathPattern('/home');

// You can then try to match it with apath
const noMatch = userRoute.match('/foo'); // => false
const match = userRoute.match('/home'); // => { isExact: true, params: {}, path: "/home", "url": "/home" }

Versioning

We use SemVer for versioning. For the versions available, see the releases on this repository.

License

This project is licensed under the MIT License - see the LICENSE.md file for details

2.1.1

6 years ago

2.1.0

6 years ago

2.0.1

6 years ago

1.1.0

7 years ago

1.0.6

7 years ago

1.0.5

7 years ago

0.9.0

7 years ago

0.8.2

7 years ago

0.8.1

7 years ago

0.8.0

7 years ago

0.7.1

7 years ago

0.7.0

7 years ago

0.6.0

7 years ago

0.5.2

7 years ago

0.5.0

7 years ago

0.4.0

7 years ago

0.3.1

7 years ago

0.2.3

7 years ago

0.2.2

7 years ago

0.2.1

7 years ago

0.1.2

7 years ago

0.1.1

7 years ago

0.1.0

7 years ago