
Research
/Security News
Weaponizing Discord for Command and Control Across npm, PyPI, and RubyGems.org
Socket researchers uncover how threat actors weaponize Discord across the npm, PyPI, and RubyGems ecosystems to exfiltrate sensitive data.
raml-path-match
Advanced tools
Path matching utility based on the RAML spec.
npm install raml-path-match --save
You must require the module and call it as a function with options to get the path matching utility back.
const ramlPathMatch = require('raml-path-match')
const utils = require('./utils')
// Initialization Options
const options = {}
// Array<webapi-parser.Parameter>
const parameters = utils.getPathParameters()
// Create a simple path matching instance.
const pathMatch = ramlPathMatch('/{route}', parameters, options)
pathMatch('/test'); //=> { match: '/test', params: { route: 'test' } }
false
, the route will only match the beginning of paths.true
, the route must match exactly without trailing slash.true
, the route will be case-sensitive.The route is a string that can be interpolated with parameters. E.g. /{route}
.
Parameters in the route string must be defined as an array of webapi-parser Parameter
objects.
Parameters can be optional according to the RAML spec. With optional parameters, /{route}
will match just /
. When the parameter is optional and not matched, the parameter value will be set to undefined
.
The path matching instance will return a function after you give it the route template. This function is used to match the current path against the route template. If the route does not match, false
is returned. If it does match, an object will be returned.
{
match: '/123',
params: {
route: 123
}
}
The above is an example of passing the path /123
to the result of the previous example. Notice that parameters will be automatically sanitized to the native JavaScript types.
You can merge more parameters into the path after creation using pathMatch.update(params)
. It'll return a new patch matching function.
Apache 2.0
FAQs
Path matching utility based on the RAML spec
The npm package raml-path-match receives a total of 664 weekly downloads. As such, raml-path-match popularity was classified as not popular.
We found that raml-path-match demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 4 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.
Research
/Security News
Socket researchers uncover how threat actors weaponize Discord across the npm, PyPI, and RubyGems ecosystems to exfiltrate sensitive data.
Security News
Socket now integrates with Bun 1.3’s Security Scanner API to block risky packages at install time and enforce your organization’s policies in local dev and CI.
Research
The Socket Threat Research Team is tracking weekly intrusions into the npm registry that follow a repeatable adversarial playbook used by North Korean state-sponsored actors.