
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
pathcat 🐾Simply path/URL building in JavaScript. Intelligently handles URL params and query strings.
This library owes thanks to urlcat, which unfortunately seems to be abandoned.
Consider pathcat as a suitable replacement.
bun add pathcat
import { pathcat } from 'pathcat';
pathcat('https://example.com', '/:id', {
id: 123,
});
// => 'https://example.com/123'
pathcat('https://example.com', '/:id', {
id: '123',
foo: 'bar',
});
// => 'https://example.com/123?foo=bar'
// Base URL is optional, works on just paths as well.
pathcat('/users/:user_id/posts/:post_id', {
user_id: '123',
post_id: 456,
cool_flag: true,
});
// => '/users/123/posts/456?cool_flag=true'
// You can also use arrays for query string values
pathcat('/users/:user_id/posts/:post_id', {
user_id: '123',
post_id: 456,
cool_flag: true,
fields: ['title', 'body'],
});
// => '/users/123/posts/456?cool_flag=true&fields=title&fields=body'
base() FunctionCreate a reusable function with a base URL, useful for repeated usage on a specific base URL (e.g., when writing a RESTful HTTP API client):
import { base } from 'pathcat';
const api = base('https://api.example.com');
api('/users/:id', { id: 123 });
// => 'https://api.example.com/users/123'
api('/posts/:post_id', { post_id: 456, include: ['author', 'comments'] });
// => 'https://api.example.com/posts/456?include=author&include=comments'
Results when running on an M4 Max
$ node -v
v22.18.0
$ node --import=tsx benchmark
pathcat() With a base URL x 3,576,027 ops/sec ±0.70% (91 runs sampled)
pathcat() With no base URL x 4,275,819 ops/sec ±0.57% (95 runs sampled)
pathcat() With a base URL, and no params x 80,913,930 ops/sec ±1.84% (89 runs sampled)
join() with 2 arguments x 72,378,677 ops/sec ±1.76% (89 runs sampled)
join() with many arguments x 5,595,168 ops/sec ±0.53% (92 runs sampled)
undefined will be omitted.FAQs
pathcat makes URLs easy
We found that pathcat demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer 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
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.