Socket
Socket
Sign inDemoInstall

radix3

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

radix3 - npm Package Compare versions

Comparing version 1.0.0 to 1.0.1

./dist/index.cjs

16

dist/index.d.ts

@@ -6,10 +6,10 @@ declare const NODE_TYPES: {

};
declare type _NODE_TYPES = typeof NODE_TYPES;
declare type NODE_TYPE = _NODE_TYPES[keyof _NODE_TYPES];
declare type _RadixNodeDataObject = {
type _NODE_TYPES = typeof NODE_TYPES;
type NODE_TYPE = _NODE_TYPES[keyof _NODE_TYPES];
type _RadixNodeDataObject = {
params?: never;
[key: string]: any;
};
declare type RadixNodeData<T extends _RadixNodeDataObject = _RadixNodeDataObject> = T;
declare type MatchedRoute<T extends RadixNodeData = RadixNodeData> = Omit<T, 'params'> & {
type RadixNodeData<T extends _RadixNodeDataObject = _RadixNodeDataObject> = T;
type MatchedRoute<T extends RadixNodeData = RadixNodeData> = Omit<T, "params"> & {
params?: Record<string, any>;

@@ -42,3 +42,3 @@ };

* @returns The data that was originally inserted into the tree
*/
*/
lookup(path: string): MatchedRoute<T> | null;

@@ -50,3 +50,3 @@ /**

*
*/
*/
insert(path: string, data: T): void;

@@ -58,3 +58,3 @@ /**

* @returns A boolean signifying if the remove was successful or not
*/
*/
remove(path: string): boolean;

@@ -61,0 +61,0 @@ }

{
"name": "radix3",
"version": "1.0.0",
"version": "1.0.1",
"description": "Lightweight and fast router for JavaScript based on Radix Tree",

@@ -22,2 +22,20 @@ "repository": "unjs/radix3",

],
"devDependencies": {
"0x": "^5.5.0",
"@vitest/coverage-c8": "^0.29.7",
"autocannon": "^7.10.0",
"benchmark": "^2.1.4",
"changelogen": "^0.5.1",
"eslint": "^8.36.0",
"eslint-config-unjs": "^0.1.0",
"jiti": "^1.18.2",
"listhen": "^1.0.4",
"ohmyfetch": "^0.4.21",
"prettier": "^2.8.7",
"standard-version": "^9.5.0",
"typescript": "^5.0.2",
"unbuild": "^1.1.2",
"vitest": "^0.29.7"
},
"packageManager": "pnpm@7.30.3",
"scripts": {

@@ -29,24 +47,8 @@ "bench": "node ./benchmark/direct.mjs",

"dev": "vitest",
"lint": "eslint --ext .ts,.mjs .",
"lint": "eslint --ext .ts,.mjs . && prettier -c src tests",
"lint:fix": "eslint --fix --ext .ts,.mjs . && prettier -w src tests",
"playground": "pnpm jiti ./playground.ts",
"release": "pnpm test && pnpm build && changelogen --release && git push --follow-tags && pnpm publish",
"test": "pnpm lint && vitest run"
},
"devDependencies": {
"0x": "^5.4.1",
"@vitest/coverage-c8": "^0.25.2",
"autocannon": "^7.10.0",
"benchmark": "^2.1.4",
"changelogen": "^0.4.0",
"eslint": "^8.27.0",
"eslint-config-unjs": "^0.0.2",
"jiti": "^1.16.0",
"listhen": "^1.0.0",
"ohmyfetch": "^0.4.21",
"standard-version": "^9.5.0",
"typescript": "^4.8.4",
"unbuild": "^0.9.4",
"vitest": "^0.25.2"
},
"packageManager": "pnpm@7.16.0"
}
}
}

@@ -5,5 +5,6 @@ # 🌳 radix3

[![npm downloads][npm-downloads-src]][npm-downloads-href]
[![Github Actions][github-actions-src]][github-actions-href]
[![bundle][bundle-src]][bundle-href]
[![Codecov][codecov-src]][codecov-href]
[![bundle][bundle-src]][bundle-href]
[![License][license-src]][license-href]
[![JSDocs][jsdocs-src]][jsdocs-href]

@@ -48,16 +49,16 @@ Lightweight and fast router for JavaScript based on [Radix Tree](https://en.wikipedia.org/wiki/Radix_tree).

***Match route to access matched data:**
**Match route to access matched data:**
```js
router.lookup('/path')
// { payload: 'this path' }
router.lookup('/path')
router.lookup('/path/fooval')
// { payload: 'named route', params: { name: 'fooval' } }
router.lookup('/path/fooval')
router.lookup('/path/foo/bar/baz')
// { payload: 'wildcard route' }
router.lookup('/path/foo/bar/baz')
router.lookup('/')
// null (no route matched for/)
router.lookup('/')
```

@@ -69,3 +70,3 @@

`path` can be static or using `:placeholder`s and `**` for wildcard paths.
`path` can be static or using `:placeholder` or `**` for wildcard paths.

@@ -93,3 +94,2 @@ The `data` object will be returned on matching params. It should be an object like `{ handler }` and not containing reserved keyword `params`.

})
```

@@ -102,4 +102,2 @@

**Experimental feature:** Behavior might change in a semver-minor release.
Creates a multi matcher from router tree that can match **all routes** matching path:

@@ -149,15 +147,13 @@

<!-- Badges -->
[npm-version-src]: https://img.shields.io/npm/v/radix3?style=flat-square
[npm-version-src]: https://img.shields.io/npm/v/radix3?style=flat&colorA=18181B&colorB=F0DB4F
[npm-version-href]: https://npmjs.com/package/radix3
[npm-downloads-src]: https://img.shields.io/npm/dm/radix3?style=flat-square
[npm-downloads-src]: https://img.shields.io/npm/dm/radix3?style=flat&colorA=18181B&colorB=F0DB4F
[npm-downloads-href]: https://npmjs.com/package/radix3
[github-actions-src]: https://img.shields.io/github/workflow/status/unjs/radix3/ci/main?style=flat-square
[github-actions-href]: https://github.com/unjs/radix3/actions?query=workflow%3Aci
[codecov-src]: https://img.shields.io/codecov/c/gh/unjs/radix3/main?style=flat-square
[codecov-src]: https://img.shields.io/codecov/c/gh/unjs/radix3/main?style=flat&colorA=18181B&colorB=F0DB4F
[codecov-href]: https://codecov.io/gh/unjs/radix3
[bundle-src]: https://img.shields.io/bundlephobia/minzip/radix3?style=flat-square
[bundle-src]: https://img.shields.io/bundlephobia/minzip/radix3?style=flat&colorA=18181B&colorB=F0DB4F
[bundle-href]: https://bundlephobia.com/result?p=radix3
[license-src]: https://img.shields.io/github/license/unjs/radix3.svg?style=flat&colorA=18181B&colorB=F0DB4F
[license-href]: https://github.com/unjs/radix3/blob/main/LICENSE
[jsdocs-src]: https://img.shields.io/badge/jsDocs.io-reference-18181B?style=flat&colorA=18181B&colorB=F0DB4F
[jsdocs-href]: https://www.jsdocs.io/package/radix3

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc