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.
egg-path-matching
Advanced tools
npm install egg-path-matching
import { pathMatching } from 'egg-path-matching';
const options = {
ignore: '/api', // string will use parsed by path-to-regexp
// support regexp
ignore: /^\/api/,
// support function
ignore: ctx => ctx.path.startsWith('/api'),
// support Array
ignore: [ ctx => ctx.path.startsWith('/api'), /^\/foo$/, '/bar'],
// support match or ignore
match: '/api',
};
const match = pathMatching(options);
assert.equal(match({ path: '/api' }), true);
assert.equal(match({ path: '/api/hello' }), true);
assert.equal(match({ path: '/api' }), true);
match
{String | RegExp | Function | Array} - if request path hit options.match
, will return true
, otherwise will return false
.ignore
{String | RegExp | Function | Array} - if request path hit options.ignore
, will return false
, otherwise will return true
.ignore
and match
can not both be presented.
and if neither ignore
nor match
presented, the new function will always return true
.
dead-horse | fengmk2 | releasethecow | atian25 | xyeric |
---|
This project follows the git-contributor spec, auto updated at Thu Dec 14 2023 17:20:14 GMT+0800
.
FAQs
match or ignore url path
The npm package egg-path-matching receives a total of 16,136 weekly downloads. As such, egg-path-matching popularity was classified as popular.
We found that egg-path-matching demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 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.