Security News
ESLint is Now Language-Agnostic: Linting JSON, Markdown, and Beyond
ESLint has added JSON and Markdown linting support with new officially-supported plugins, expanding its versatility beyond JavaScript.
path-pattern
Advanced tools
A small library to match and compile paths like /user/:name
This is a a wrapper around path-to-regexp.
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 😉.
You need NodeJS and NPM or Yarn to install this package.
yarn add path-pattern
or npm install path-pattern --save
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.
Note : If you use Typescript, typings are include in the package !
import { createPattern } from 'path-pattern';
const PathPattern = require('path-pattern').PathPattern;
// 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" }
We use SemVer for versioning. For the versions available, see the releases on this repository.
This project is licensed under the MIT License - see the LICENSE.md file for details
FAQs
A url matching lib to go with Realytics/react-router-magic
The npm package path-pattern receives a total of 0 weekly downloads. As such, path-pattern popularity was classified as not popular.
We found that path-pattern demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
ESLint has added JSON and Markdown linting support with new officially-supported plugins, expanding its versatility beyond JavaScript.
Security News
Members Hub is conducting large-scale campaigns to artificially boost Discord server metrics, undermining community trust and platform integrity.
Security News
NIST has failed to meet its self-imposed deadline of clearing the NVD's backlog by the end of the fiscal year. Meanwhile, CVE's awaiting analysis have increased by 33% since June.