Browse Source

refactor: replaces debugger implementation with @e22m4u/js-debug

e22m4u 2 months ago
parent
commit
94a517f92a
8 changed files with 111 additions and 218 deletions
  1. 49 60
      dist/cjs/index.cjs
  2. 1 0
      eslint.config.js
  3. 9 9
      package.json
  4. 46 118
      src/path-trie.js
  5. 6 6
      src/path-trie.spec.js
  6. 0 15
      src/utils/create-debugger.js
  7. 0 9
      src/utils/create-debugger.spec.js
  8. 0 1
      src/utils/index.js

+ 49 - 60
dist/cjs/index.cjs

@@ -1,8 +1,6 @@
-var __create = Object.create;
 var __defProp = Object.defineProperty;
 var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
 var __getOwnPropNames = Object.getOwnPropertyNames;
-var __getProtoOf = Object.getPrototypeOf;
 var __hasOwnProp = Object.prototype.hasOwnProperty;
 var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
 var __export = (target, all) => {
@@ -17,14 +15,6 @@ var __copyProps = (to, from, except, desc) => {
   }
   return to;
 };
-var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
-  // If the importer is in node compatibility mode or this is not an ESM
-  // file that has been converted to a CommonJS file using a Babel-
-  // compatible transform (i.e. "__esModule" has not been set), then set
-  // "default" to the CommonJS "module.exports" for node compatibility.
-  isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
-  mod
-));
 var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
 
 // src/index.js
@@ -35,24 +25,16 @@ __export(index_exports, {
 module.exports = __toCommonJS(index_exports);
 
 // src/path-trie.js
-var import_js_format2 = require("@e22m4u/js-format");
-var import_path_to_regexp = require("path-to-regexp");
-
-// src/utils/create-debugger.js
-var import_debug = __toESM(require("debug"), 1);
 var import_js_format = require("@e22m4u/js-format");
-function createDebugger() {
-  const debug2 = (0, import_debug.default)(`jsPathTrie`);
-  return function(message, ...args) {
-    const interpolatedMessage = (0, import_js_format.format)(message, ...args);
-    return debug2(interpolatedMessage);
-  };
-}
-__name(createDebugger, "createDebugger");
-
-// src/path-trie.js
-var debug = createDebugger();
-var _PathTrie = class _PathTrie {
+var import_js_debug = require("@e22m4u/js-debug");
+var import_path_to_regexp = require("path-to-regexp");
+var _PathTrie = class _PathTrie extends import_js_debug.Debuggable {
+  /**
+   * Constructor.
+   */
+  constructor() {
+    super({ noEnvNs: true, namespace: "jsPathTrie" });
+  }
   /**
    * Root node.
    *
@@ -74,17 +56,18 @@ var _PathTrie = class _PathTrie {
    * @returns {this}
    */
   add(pathTemplate, value) {
+    const debug = this.getDebuggerFor(this.add);
     if (typeof pathTemplate !== "string")
-      throw new import_js_format2.Errorf(
-        "The first argument of PathTrie.add should be a String, but %v given.",
+      throw new import_js_format.Errorf(
+        "The first argument of PathTrie.add must be a String, but %v was given.",
         pathTemplate
       );
     if (value == null)
-      throw new import_js_format2.Errorf(
-        "The second argument of PathTrie.add is required, but %v given.",
+      throw new import_js_format.Errorf(
+        "The second argument of PathTrie.add is required, but %v was given.",
         value
       );
-    debug("Adding the value to %v.", pathTemplate);
+    debug("Adding a value for the path %v.", pathTemplate);
     const tokens = pathTemplate.split("/").filter(Boolean);
     this._createNode(tokens, 0, value, this._root);
     return this;
@@ -96,12 +79,13 @@ var _PathTrie = class _PathTrie {
    * @returns {ResolvedValue|undefined}
    */
   match(path) {
+    const debug = this.getDebuggerFor(this.match);
     if (typeof path !== "string")
-      throw new import_js_format2.Errorf(
-        "The first argument of PathTrie.match should be a String, but %v given.",
+      throw new import_js_format.Errorf(
+        "The first argument of PathTrie.match must be a String, but %v was given.",
         path
       );
-    debug("Matching a value with the path %v.", path);
+    debug("Matching a value for the path %v.", path);
     const tokens = path.split("/").filter(Boolean);
     const params = {};
     const result = this._matchNode(tokens, 0, params, this._root);
@@ -119,34 +103,35 @@ var _PathTrie = class _PathTrie {
    * @private
    */
   _createNode(tokens, index, value, parent) {
+    const debug = this.getDebuggerFor(this._createNode);
     if (tokens.length === 0 && index === 0) {
       if (parent.value == null) {
         parent.value = value;
       } else if (parent.value !== value) {
-        throw new import_js_format2.Errorf('The duplicate path "" has a different value.');
+        throw new import_js_format.Errorf('The duplicate path "" has a different value.');
       }
-      debug("The value has set to the root node.");
+      debug("The value has been set for the root node.");
       return parent;
     }
     const token = tokens[index];
     if (token == null)
-      throw new import_js_format2.Errorf(
-        "Invalid index %v has passed to the PathTrie._createNode.",
+      throw new import_js_format.Errorf(
+        "Invalid index %v was passed to PathTrie._createNode.",
         index
       );
     let child = parent.children[token];
     const isLast = tokens.length - 1 === index;
     if (child) {
       if (!isLast) {
-        debug("The node %v already exist.", token);
+        debug("The node %v already exists.", token);
         return this._createNode(tokens, index + 1, value, child);
       } else {
-        debug("The node %v already exist.", token);
+        debug("The node %v already exists.", token);
         if (child.value == null) {
           debug("The node %v has the same value.", token);
           child.value = value;
         } else if (child.value !== value) {
-          throw new import_js_format2.Errorf(
+          throw new import_js_format.Errorf(
             "The duplicate path %v has a different value.",
             "/" + tokens.join("/")
           );
@@ -163,14 +148,14 @@ var _PathTrie = class _PathTrie {
       children: {}
     };
     if (isLast) {
-      debug("The node %v is last.", token);
+      debug("The node %v is the last.", token);
       child.value = value;
     }
     if (token.indexOf(":") > -1) {
       debug("The node %v has parameters.", token);
       const modifiers = /([?*+{}])/.exec(token);
       if (modifiers)
-        throw new import_js_format2.Errorf(
+        throw new import_js_format.Errorf(
           "The symbol %v is not supported in path %v.",
           modifiers[0],
           "/" + tokens.join("/")
@@ -182,8 +167,8 @@ var _PathTrie = class _PathTrie {
         keys = regexpAndKeys.keys;
       } catch (error) {
         if (error.message.indexOf("Missing parameter") > -1)
-          throw new import_js_format2.Errorf(
-            'The symbol ":" should be used to define path parameters, but no parameters found in the path %v.',
+          throw new import_js_format.Errorf(
+            'The symbol ":" should be used to define path parameters, but no parameters were found in the path %v.',
             "/" + tokens.join("/")
           );
         throw error;
@@ -192,15 +177,15 @@ var _PathTrie = class _PathTrie {
         child.names = keys.map((p) => `${p.name}`);
         child.regexp = regexp;
       } else {
-        throw new import_js_format2.Errorf(
-          'The symbol ":" should be used to define path parameters, but no parameters found in the path %v.',
+        throw new import_js_format.Errorf(
+          'The symbol ":" should be used to define path parameters, but no parameters were found in the path %v.',
           "/" + tokens.join("/")
         );
       }
-      debug("Found parameters are %l.", child.names);
+      debug("The found parameters are %l.", child.names);
     }
     parent.children[token] = child;
-    debug("The node %v has created.", token);
+    debug("The node %v has been created.", token);
     if (isLast) return child;
     return this._createNode(tokens, index + 1, value, child);
   }
@@ -215,28 +200,26 @@ var _PathTrie = class _PathTrie {
    * @private
    */
   _matchNode(tokens, index, params, parent) {
+    const debug = this.getDebuggerFor(this._matchNode);
     if (tokens.length === 0 && index === 0) {
       if (parent.value) {
-        debug(
-          "The path %v matched with the root node.",
-          "/" + tokens.join("/")
-        );
+        debug("The path %v matched the root node.", "/" + tokens.join("/"));
         return { node: parent, params };
       }
       return;
     }
     const token = tokens[index];
     if (token == null)
-      throw new import_js_format2.Errorf(
-        "Invalid index %v has passed to the PathTrie._matchNode.",
+      throw new import_js_format.Errorf(
+        "Invalid index %v was passed to PathTrie._matchNode.",
         index
       );
     const resolvedNodes = this._matchChildrenNodes(token, parent);
-    debug("%v nodes matches the token %v.", resolvedNodes.length, token);
+    debug("%v nodes match the token %v.", resolvedNodes.length, token);
     if (!resolvedNodes.length) return;
     const isLast = tokens.length - 1 === index;
     if (isLast) {
-      debug("The token %v is last.", token);
+      debug("The token %v is the last.", token);
       for (const child of resolvedNodes) {
         debug("The node %v matches the token %v.", child.node.token, token);
         if (child.node.value) {
@@ -262,7 +245,10 @@ var _PathTrie = class _PathTrie {
       for (const child of resolvedNodes) {
         const result = this._matchNode(tokens, index + 1, params, child.node);
         if (result) {
-          debug("A value has found for the path %v.", "/" + tokens.join("/"));
+          debug(
+            "A value has been found for the path %v.",
+            "/" + tokens.join("/")
+          );
           const paramNames = Object.keys(child.params);
           if (paramNames.length) {
             paramNames.forEach((name) => {
@@ -281,7 +267,10 @@ var _PathTrie = class _PathTrie {
         }
       }
     }
-    debug("No matched nodes with the path %v.", "/" + tokens.join("/"));
+    debug(
+      "No matching nodes were found for the path %v.",
+      "/" + tokens.join("/")
+    );
     return void 0;
   }
   /**

+ 1 - 0
eslint.config.js

@@ -25,6 +25,7 @@ export default [{
     ...eslintMochaPlugin.configs.recommended.rules,
     ...eslintChaiExpectPlugin.configs['recommended-flat'].rules,
     'no-unused-vars': ['error', {'caughtErrors': 'none'}],
+    'jsdoc/reject-any-type': 0,
     'jsdoc/require-param-description': 0,
     'jsdoc/require-returns-description': 0,
     'jsdoc/require-property-description': 0,

+ 9 - 9
package.json

@@ -36,25 +36,25 @@
     "prepare": "husky"
   },
   "dependencies": {
-    "@e22m4u/js-format": "~0.1.8",
-    "debug": "~4.4.1",
-    "path-to-regexp": "~8.2.0"
+    "@e22m4u/js-debug": "~0.2.3",
+    "@e22m4u/js-format": "~0.2.0",
+    "path-to-regexp": "~8.3.0"
   },
   "devDependencies": {
     "@commitlint/cli": "~19.8.1",
     "@commitlint/config-conventional": "~19.8.1",
-    "@eslint/js": "~9.34.0",
+    "@eslint/js": "~9.36.0",
     "c8": "~10.1.3",
     "chai": "~6.0.1",
-    "esbuild": "~0.25.9",
-    "eslint": "~9.34.0",
+    "esbuild": "~0.25.10",
+    "eslint": "~9.36.0",
     "eslint-config-prettier": "~10.1.8",
     "eslint-plugin-chai-expect": "~3.1.0",
-    "eslint-plugin-jsdoc": "~54.1.1",
+    "eslint-plugin-jsdoc": "~60.3.0",
     "eslint-plugin-mocha": "~11.1.0",
-    "globals": "~16.3.0",
+    "globals": "~16.4.0",
     "husky": "~9.1.7",
-    "mocha": "~11.7.1",
+    "mocha": "~11.7.2",
     "prettier": "~3.6.2",
     "rimraf": "~6.0.1",
     "typescript": "~5.9.2"

+ 46 - 118
src/path-trie.js

@@ -1,6 +1,6 @@
 import {Errorf} from '@e22m4u/js-format';
+import {Debuggable} from '@e22m4u/js-debug';
 import {pathToRegexp} from 'path-to-regexp';
-import {createDebugger} from './utils/index.js';
 
 /**
  * @typedef {{
@@ -15,17 +15,17 @@ import {createDebugger} from './utils/index.js';
  * @typedef {{node: Node, params: object}} ResolvedNode
  */
 
-/**
- * Debug.
- *
- * @type {Function}
- */
-const debug = createDebugger();
-
 /**
  * Path trie.
  */
-export class PathTrie {
+export class PathTrie extends Debuggable {
+  /**
+   * Constructor.
+   */
+  constructor() {
+    super({noEnvNs: true, namespace: 'jsPathTrie'});
+  }
+
   /**
    * Root node.
    *
@@ -48,18 +48,19 @@ export class PathTrie {
    * @returns {this}
    */
   add(pathTemplate, value) {
+    const debug = this.getDebuggerFor(this.add);
     if (typeof pathTemplate !== 'string')
       throw new Errorf(
-        'The first argument of PathTrie.add should be ' +
-          'a String, but %v given.',
+        'The first argument of PathTrie.add must be a String, ' +
+          'but %v was given.',
         pathTemplate,
       );
     if (value == null)
       throw new Errorf(
-        'The second argument of PathTrie.add is required, but %v given.',
+        'The second argument of PathTrie.add is required, but %v was given.',
         value,
       );
-    debug('Adding the value to %v.', pathTemplate);
+    debug('Adding a value for the path %v.', pathTemplate);
     const tokens = pathTemplate.split('/').filter(Boolean);
     this._createNode(tokens, 0, value, this._root);
     return this;
@@ -72,13 +73,14 @@ export class PathTrie {
    * @returns {ResolvedValue|undefined}
    */
   match(path) {
+    const debug = this.getDebuggerFor(this.match);
     if (typeof path !== 'string')
       throw new Errorf(
-        'The first argument of PathTrie.match should be ' +
-          'a String, but %v given.',
+        'The first argument of PathTrie.match must be a String, ' +
+          'but %v was given.',
         path,
       );
-    debug('Matching a value with the path %v.', path);
+    debug('Matching a value for the path %v.', path);
     const tokens = path.split('/').filter(Boolean);
     const params = {};
     const result = this._matchNode(tokens, 0, params, this._root);
@@ -97,70 +99,43 @@ export class PathTrie {
    * @private
    */
   _createNode(tokens, index, value, parent) {
-    // если массив токенов пуст, а индекс нулевой,
-    // то проверяем возможность установки значения
-    // в родителя
+    const debug = this.getDebuggerFor(this._createNode);
     if (tokens.length === 0 && index === 0) {
-      // если корневой узел не имеет
-      // значения, то устанавливаем
       if (parent.value == null) {
         parent.value = value;
-      }
-      // если корневой узел имеет значение
-      // отличное от устанавливаемого,
-      // то выбрасываем ошибку
-      else if (parent.value !== value) {
+      } else if (parent.value !== value) {
         throw new Errorf('The duplicate path "" has a different value.');
       }
-      debug('The value has set to the root node.');
+      debug('The value has been set for the root node.');
       return parent;
     }
-    // проверка существования токена
-    // по данному индексу
     const token = tokens[index];
     if (token == null)
       throw new Errorf(
-        'Invalid index %v has passed to the PathTrie._createNode.',
+        'Invalid index %v was passed to PathTrie._createNode.',
         index,
       );
-    // проверка существования узла
-    // по текущему токену
     let child = parent.children[token];
     const isLast = tokens.length - 1 === index;
     if (child) {
-      // если узел не является последним,
-      // то переходим к следующему
       if (!isLast) {
-        debug('The node %v already exist.', token);
+        debug('The node %v already exists.', token);
         return this._createNode(tokens, index + 1, value, child);
-      }
-      // если узел является последним,
-      // то проверяем наличие значения
-      else {
-        debug('The node %v already exist.', token);
-        // если существующий узел не имеет
-        // значения, то устанавливаем текущее
+      } else {
+        debug('The node %v already exists.', token);
         if (child.value == null) {
           debug('The node %v has the same value.', token);
           child.value = value;
-        }
-        // если существующий узел имеет
-        // значение отличное от текущего,
-        // то выбрасываем ошибку
-        else if (child.value !== value) {
+        } else if (child.value !== value) {
           throw new Errorf(
             'The duplicate path %v has a different value.',
             '/' + tokens.join('/'),
           );
         }
-        // так как данный токен является последним,
-        // то возвращаем существующий узел
         return child;
       }
     }
     debug('The node %v does not exist.', token);
-    // создаем новый узел, и если токен является
-    // последним, то сразу устанавливаем значение
     child = {
       token,
       regexp: undefined,
@@ -169,16 +144,11 @@ export class PathTrie {
       children: {},
     };
     if (isLast) {
-      debug('The node %v is last.', token);
+      debug('The node %v is the last.', token);
       child.value = value;
     }
-    // если токен содержит параметры,
-    // то записываем их имена и регулярное
-    // выражение в создаваемый узел
     if (token.indexOf(':') > -1) {
       debug('The node %v has parameters.', token);
-      // если токен содержит неподдерживаемые
-      // модификаторы, то выбрасываем ошибку
       const modifiers = /([?*+{}])/.exec(token);
       if (modifiers)
         throw new Errorf(
@@ -186,51 +156,34 @@ export class PathTrie {
           modifiers[0],
           '/' + tokens.join('/'),
         );
-      // определение регулярного выражения
-      // и параметров текущего токена
       let regexp, keys;
       try {
         const regexpAndKeys = pathToRegexp(token);
         regexp = regexpAndKeys.regexp;
         keys = regexpAndKeys.keys;
       } catch (error) {
-        // если параметры не найдены, то выбрасываем
-        // ошибку неправильного использования
-        // символа ":"
         if (error.message.indexOf('Missing parameter') > -1)
           throw new Errorf(
             'The symbol ":" should be used to define path parameters, ' +
-              'but no parameters found in the path %v.',
+              'but no parameters were found in the path %v.',
             '/' + tokens.join('/'),
           );
-        // если ошибка неизвестна,
-        // то выбрасываем как есть
         throw error;
       }
-      // записываем имена параметров и регулярное
-      // выражение в создаваемый узел
       if (Array.isArray(keys) && keys.length) {
         child.names = keys.map(p => `${p.name}`);
         child.regexp = regexp;
-      }
-      // если параметры не найдены, то выбрасываем
-      // ошибку неправильного использования
-      // символа ":"
-      else {
+      } else {
         throw new Errorf(
           'The symbol ":" should be used to define path parameters, ' +
-            'but no parameters found in the path %v.',
+            'but no parameters were found in the path %v.',
           '/' + tokens.join('/'),
         );
       }
-      debug('Found parameters are %l.', child.names);
+      debug('The found parameters are %l.', child.names);
     }
-    // записываем новый узел в родителя
     parent.children[token] = child;
-    debug('The node %v has created.', token);
-    // если текущий узел является последним,
-    // то возвращаем его, или продолжаем
-    // смещать индекс
+    debug('The node %v has been created.', token);
     if (isLast) return child;
     return this._createNode(tokens, index + 1, value, child);
   }
@@ -246,39 +199,26 @@ export class PathTrie {
    * @private
    */
   _matchNode(tokens, index, params, parent) {
-    // если массив токенов пуст, а индекс нулевой,
-    // то проверяем наличие значения в родителе
+    const debug = this.getDebuggerFor(this._matchNode);
     if (tokens.length === 0 && index === 0) {
       if (parent.value) {
-        debug(
-          'The path %v matched with the root node.',
-          '/' + tokens.join('/'),
-        );
+        debug('The path %v matched the root node.', '/' + tokens.join('/'));
         return {node: parent, params};
       }
-      // если родительский узел не имеет
-      // значения, то возвращаем "undefined"
       return;
     }
-    // проверка существования токена
-    // по данному индексу
     const token = tokens[index];
     if (token == null)
       throw new Errorf(
-        'Invalid index %v has passed to the PathTrie._matchNode.',
+        'Invalid index %v was passed to PathTrie._matchNode.',
         index,
       );
-    // если текущий токен не соответствует
-    // ни одному узлу, то возвращаем "undefined"
     const resolvedNodes = this._matchChildrenNodes(token, parent);
-    debug('%v nodes matches the token %v.', resolvedNodes.length, token);
+    debug('%v nodes match the token %v.', resolvedNodes.length, token);
     if (!resolvedNodes.length) return;
-    // если текущий токен последний,
-    // то возвращаем первый дочерний
-    // узел, который имеет значение
     const isLast = tokens.length - 1 === index;
     if (isLast) {
-      debug('The token %v is last.', token);
+      debug('The token %v is the last.', token);
       for (const child of resolvedNodes) {
         debug('The node %v matches the token %v.', child.node.token, token);
         if (child.node.value) {
@@ -300,14 +240,14 @@ export class PathTrie {
           return {node: child.node, params};
         }
       }
-    }
-    // если токен промежуточный, то проходим
-    // вглубь каждого дочернего узла
-    else {
+    } else {
       for (const child of resolvedNodes) {
         const result = this._matchNode(tokens, index + 1, params, child.node);
         if (result) {
-          debug('A value has found for the path %v.', '/' + tokens.join('/'));
+          debug(
+            'A value has been found for the path %v.',
+            '/' + tokens.join('/'),
+          );
           const paramNames = Object.keys(child.params);
           if (paramNames.length) {
             paramNames.forEach(name => {
@@ -326,10 +266,10 @@ export class PathTrie {
         }
       }
     }
-    // если поиск по дочерним узлам
-    // родителя не привел к результату,
-    // то возвращаем "undefined"
-    debug('No matched nodes with the path %v.', '/' + tokens.join('/'));
+    debug(
+      'No matching nodes were found for the path %v.',
+      '/' + tokens.join('/'),
+    );
     return undefined;
   }
 
@@ -343,34 +283,22 @@ export class PathTrie {
    */
   _matchChildrenNodes(token, parent) {
     const resolvedNodes = [];
-    // если найден узел по литералу токена,
-    // то нет необходимости продолжать поиск
-    // по узлам с параметрами, а можно немедленно
-    // вернуть его в качестве результата
     let child = parent.children[token];
     if (child) {
       resolvedNodes.push({node: child, params: {}});
       return resolvedNodes;
     }
-    // поиск по узлам с параметрами выполняется
-    // путем сопоставления токена с регулярным
-    // выражением каждого узла
     for (const key in parent.children) {
       child = parent.children[key];
       if (!child.names || !child.regexp) continue;
       const match = child.regexp.exec(token);
       if (match) {
         const resolved = {node: child, params: {}};
-        // так как параметры имеют тот же порядок,
-        // что и вхождения, последовательно перебираем,
-        // и присваиваем вхождения с соответствующим
-        // индексом в качестве значений
         let i = 0;
         for (const name of child.names) {
           const val = match[++i];
           resolved.params[name] = decodeURIComponent(val);
         }
-        // добавление узла к результату
         resolvedNodes.push(resolved);
       }
     }

+ 6 - 6
src/path-trie.spec.js

@@ -13,8 +13,8 @@ describe('PathTrie', function () {
       const throwable = v => () => trie.add(v, VALUE);
       const error = v =>
         format(
-          'The first argument of PathTrie.add should be ' +
-            'a String, but %s given.',
+          'The first argument of PathTrie.add must be a String, ' +
+            'but %s was given.',
           v,
         );
       expect(throwable(10)).to.throw(error('10'));
@@ -36,7 +36,7 @@ describe('PathTrie', function () {
       };
       const error = v =>
         format(
-          'The second argument of PathTrie.add is required, but %s given.',
+          'The second argument of PathTrie.add is required, but %s was given.',
           v,
         );
       expect(throwable(undefined)).to.throw(error('undefined'));
@@ -224,7 +224,7 @@ describe('PathTrie', function () {
       const throwable = () => trie.add('/:', VALUE);
       expect(throwable).to.throw(
         'The symbol ":" should be used to define path parameters, ' +
-          'but no parameters found in the path "/:".',
+          'but no parameters were found in the path "/:".',
       );
     });
 
@@ -272,8 +272,8 @@ describe('PathTrie', function () {
       const throwable = v => () => trie.match(v);
       const error = v =>
         format(
-          'The first argument of PathTrie.match should be ' +
-            'a String, but %s given.',
+          'The first argument of PathTrie.match must be ' +
+            'a String, but %s was given.',
           v,
         );
       expect(throwable(10)).to.throw(error('10'));

+ 0 - 15
src/utils/create-debugger.js

@@ -1,15 +0,0 @@
-import DebugFactory from 'debug';
-import {format} from '@e22m4u/js-format';
-
-/**
- * Create debugger.
- *
- * @returns {Function}
- */
-export function createDebugger() {
-  const debug = DebugFactory(`jsPathTrie`);
-  return function (message, ...args) {
-    const interpolatedMessage = format(message, ...args);
-    return debug(interpolatedMessage);
-  };
-}

+ 0 - 9
src/utils/create-debugger.spec.js

@@ -1,9 +0,0 @@
-import {expect} from 'chai';
-import {createDebugger} from './create-debugger.js';
-
-describe('createDebugger', function () {
-  it('returns a function', function () {
-    const res = createDebugger('name');
-    expect(typeof res).to.be.eq('function');
-  });
-});

+ 0 - 1
src/utils/index.js

@@ -1 +0,0 @@
-export * from './create-debugger.js';