New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@e22m4u/js-path-trie

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@e22m4u/js-path-trie - npm Package Compare versions

Comparing version 0.0.3 to 0.0.4

build-cjs.js

22

package.json
{
"name": "@e22m4u/js-path-trie",
"version": "0.0.3",
"description": "A router based on a prefix tree (trie).",
"version": "0.0.4",
"description": "A router for Node.js based on a prefix tree",
"type": "module",
"main": "src/index.js",
"module": "./src/index.js",
"main": "./dist/cjs/index.cjs",
"exports": {
"import": "./src/index.js",
"require": "./dist/cjs/index.cjs"
},
"engines": {
"node": ">=16"
},
"scripts": {
"lint": "tsc && eslint .",
"lint:fix": "tsc && eslint . --fix",
"lint": "tsc && eslint ./src",
"lint:fix": "tsc && eslint ./src --fix",
"format": "prettier --write \"./src/**/*.js\"",
"test": "npm run lint && c8 --reporter=text-summary mocha",
"test:coverage": "npm run lint && c8 --reporter=text mocha",
"build:cjs": "node build-cjs.js",
"prepare": "husky"

@@ -17,3 +26,3 @@ },

"type": "git",
"url": "https://github.com/e22m4u/js-path-trie.git"
"url": "git+https://github.com/e22m4u/js-path-trie.git"
},

@@ -39,2 +48,3 @@ "keywords": [

"chai": "~5.1.1",
"esbuild": "~0.24.0",
"eslint": "~9.12.0",

@@ -41,0 +51,0 @@ "eslint-config-prettier": "~9.1.0",

@@ -5,3 +5,4 @@ ## @e22m4u/js-path-trie

Маршрутизатор на основе [префиксного дерева](https://ru.wikipedia.org/wiki/Trie) (trie).
Маршрутизатор для Node.js на основе
[префиксного дерева](https://ru.wikipedia.org/wiki/Trie) (trie).

@@ -13,2 +14,4 @@ - Использует [path-to-regexp](https://github.com/pillarjs/path-to-regexp) синтаксис.

Требуется Node.js 16 и выше.
```bash

@@ -18,11 +21,28 @@ npm install @e22m4u/js-path-trie

Для загрузки ES-модуля требуется установить `"type": "module"` в файле
`package.json`, или использовать `.mjs` расширение.
Модуль поддерживает ESM и CommonJS стандарты.
## Пример
*ESM*
- `add(pathTemplate: string, value: unknown)` - добавить значение к новому маршруту
- `match(path: string)` - поиск значения по заданному маршруту
```js
import {PathTrie} from '@e22m4u/js-path-trie';
```
*CommonJS*
```js
const {PathTrie} = require('@e22m4u/js-path-trie');
```
## Обзор
Класс `PathTrie` имеет следующие методы:
- `add(pathTemplate: string, value: unknown)` добавить значение к новому маршруту
- `match(path: string)` поиск значения по заданному маршруту
Пример:
```js
import {PathTrie} from '@e22m4u/js-path-trie';
const trie = new PathTrie();

@@ -62,3 +82,3 @@

Установка переменной `DEBUG` перед командой запуска включает вывод логов.
Установка переменной `DEBUG` включает вывод логов.

@@ -65,0 +85,0 @@ ```bash

@@ -5,3 +5,4 @@ ## @e22m4u/js-path-trie

A router based on a [prefix tree](https://en.wikipedia.org/wiki/Trie) (trie).
A router for Node.js based on
a [prefix tree](https://en.wikipedia.org/wiki/Trie) (trie).

@@ -13,2 +14,4 @@ - Uses [path-to-regexp](https://github.com/pillarjs/path-to-regexp) syntax.

Node.js 16 or higher is required.
```bash

@@ -18,11 +21,28 @@ npm install @e22m4u/js-path-trie

To load the ES-module, you need to set `"type": "module"`
in the `package.json` file, or use the `.mjs` extension.
The module supports ESM and CommonJS standards.
## Example
*ESM*
```js
import {PathTrie} from '@e22m4u/js-path-trie';
```
*CommonJS*
```js
const {PathTrie} = require('@e22m4u/js-path-trie');
```
## Overview
The `PathTrie` class has the following methods:
- `add(pathTemplate: string, value: unknown)` adds a value to a new route
- `match(path: string)` returns a value by a given path
Example:
```js
import {PathTrie} from '@e22m4u/js-path-trie';
const trie = new PathTrie();

@@ -62,3 +82,3 @@

Set the `DEBUG` variable before the run command to enable log output.
Set the `DEBUG` variable to enable log output.

@@ -65,0 +85,0 @@ ```bash

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