@catbee/utils 1.0.3 → 1.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License
2
2
 
3
- Copyright (c) 2025 Catbee Technologies. https://catbee-utils.npm.hprasath.com/license
3
+ Copyright (c) 2025 Catbee Technologies. https://catbee.npm.hprasath.com/license
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/README.md CHANGED
@@ -77,31 +77,31 @@ console.log(isEmail("user@example.com")); // true
77
77
 
78
78
  | Module | Description |
79
79
  | ------ | ----------- |
80
- | [Express Server](https://catbee-utils.npm.hprasath.com/docs/express-server) | Fast, secure, and scalable server setup |
81
- | [Array Utilities](https://catbee-utils.npm.hprasath.com/docs/utils/array) | Advanced array manipulation |
82
- | [Async Utilities](https://catbee-utils.npm.hprasath.com/docs/utils/async) | Promise helpers, concurrency, timing |
83
- | [Cache Utilities](https://catbee-utils.npm.hprasath.com/docs/utils/cache) | In-memory caching with TTL |
84
- | [Context Store](https://catbee-utils.npm.hprasath.com/docs/utils/context-store) | Per-request context via AsyncLocalStorage |
85
- | [Crypto Utilities](https://catbee-utils.npm.hprasath.com/docs/utils/crypto) | Hashing, encryption, tokens |
86
- | [Date Utilities](https://catbee-utils.npm.hprasath.com/docs/utils/date) | Date/time manipulation |
87
- | [Decorators Utilities](https://catbee-utils.npm.hprasath.com/docs/utils/decorators) | TypeScript decorators for Express |
88
- | [Directory Utilities](https://catbee-utils.npm.hprasath.com/docs/utils/directory) | Directory and file system helpers |
89
- | [Environment Utilities](https://catbee-utils.npm.hprasath.com/docs/utils/environment) | Env variable management |
90
- | [Exception Utilities](https://catbee-utils.npm.hprasath.com/docs/utils/exception) | HTTP and error handling |
91
- | [File System Utilities](https://catbee-utils.npm.hprasath.com/docs/utils/file-system) | File operations |
92
- | [HTTP Status Codes](https://catbee-utils.npm.hprasath.com/docs/utils/http-status-codes) | Typed status codes |
93
- | [ID Utilities](https://catbee-utils.npm.hprasath.com/docs/utils/id) | UUID and ID generation |
94
- | [Logger Utilities](https://catbee-utils.npm.hprasath.com/docs/utils/logger) | Structured logging with Pino |
95
- | [Middleware Utilities](https://catbee-utils.npm.hprasath.com/docs/utils/middleware) | Express middleware collection |
96
- | [Object Utilities](https://catbee-utils.npm.hprasath.com/docs/utils/object) | Deep merge, flatten, pick/omit, etc. |
97
- | [Performance Utilities](https://catbee-utils.npm.hprasath.com/docs/utils/performance) | Timing, memoization, memory tracking |
98
- | [Request Utilities](https://catbee-utils.npm.hprasath.com/docs/utils/request) | HTTP request parameter parsing/validation |
99
- | [Response Utilities](https://catbee-utils.npm.hprasath.com/docs/utils/response) | Standardized API response formatting |
100
- | [Stream Utilities](https://catbee-utils.npm.hprasath.com/docs/utils/stream) | Stream conversion, batching, throttling, line splitting |
101
- | [String Utilities](https://catbee-utils.npm.hprasath.com/docs/utils/string) | Casing, masking, slugifying, formatting |
102
- | [Type Utilities](https://catbee-utils.npm.hprasath.com/docs/utils/type) | Type checking, conversion, guards |
103
- | [URL Utilities](https://catbee-utils.npm.hprasath.com/docs/utils/url) | URL parsing, query manipulation, normalization |
104
- | [Validate Utilities](https://catbee-utils.npm.hprasath.com/docs/utils/validation) | Input validation functions |
80
+ | [Express Server](https://catbee.npm.hprasath.com/docs/@catbee/utils/express-server) | Fast, secure, and scalable server setup |
81
+ | [Array Utilities](https://catbee.npm.hprasath.com/docs/@catbee/utils/modules/array) | Advanced array manipulation |
82
+ | [Async Utilities](https://catbee.npm.hprasath.com/docs/@catbee/utils/modules/async) | Promise helpers, concurrency, timing |
83
+ | [Cache Utilities](https://catbee.npm.hprasath.com/docs/@catbee/utils/modules/cache) | In-memory caching with TTL |
84
+ | [Context Store](https://catbee.npm.hprasath.com/docs/@catbee/utils/modules/context-store) | Per-request context via AsyncLocalStorage |
85
+ | [Crypto Utilities](https://catbee.npm.hprasath.com/docs/@catbee/utils/modules/crypto) | Hashing, encryption, tokens |
86
+ | [Date Utilities](https://catbee.npm.hprasath.com/docs/@catbee/utils/modules/date) | Date/time manipulation |
87
+ | [Decorators Utilities](https://catbee.npm.hprasath.com/docs/@catbee/utils/modules/decorators) | TypeScript decorators for Express |
88
+ | [Directory Utilities](https://catbee.npm.hprasath.com/docs/@catbee/utils/modules/directory) | Directory and file system helpers |
89
+ | [Environment Utilities](https://catbee.npm.hprasath.com/docs/@catbee/utils/modules/environment) | Env variable management |
90
+ | [Exception Utilities](https://catbee.npm.hprasath.com/docs/@catbee/utils/modules/exception) | HTTP and error handling |
91
+ | [File System Utilities](https://catbee.npm.hprasath.com/docs/@catbee/utils/modules/file-system) | File operations |
92
+ | [HTTP Status Codes](https://catbee.npm.hprasath.com/docs/@catbee/utils/modules/http-status-codes) | Typed status codes |
93
+ | [ID Utilities](https://catbee.npm.hprasath.com/docs/@catbee/utils/modules/id) | UUID and ID generation |
94
+ | [Logger Utilities](https://catbee.npm.hprasath.com/docs/@catbee/utils/modules/logger) | Structured logging with Pino |
95
+ | [Middleware Utilities](https://catbee.npm.hprasath.com/docs/@catbee/utils/modules/middleware) | Express middleware collection |
96
+ | [Object Utilities](https://catbee.npm.hprasath.com/docs/@catbee/utils/modules/object) | Deep merge, flatten, pick/omit, etc. |
97
+ | [Performance Utilities](https://catbee.npm.hprasath.com/docs/@catbee/utils/modules/performance) | Timing, memoization, memory tracking |
98
+ | [Request Utilities](https://catbee.npm.hprasath.com/docs/@catbee/utils/modules/request) | HTTP request parameter parsing/validation |
99
+ | [Response Utilities](https://catbee.npm.hprasath.com/docs/@catbee/utils/modules/response) | Standardized API response formatting |
100
+ | [Stream Utilities](https://catbee.npm.hprasath.com/docs/@catbee/utils/modules/stream) | Stream conversion, batching, throttling, line splitting |
101
+ | [String Utilities](https://catbee.npm.hprasath.com/docs/@catbee/utils/modules/string) | Casing, masking, slugifying, formatting |
102
+ | [Type Utilities](https://catbee.npm.hprasath.com/docs/@catbee/utils/modules/type) | Type checking, conversion, guards |
103
+ | [URL Utilities](https://catbee.npm.hprasath.com/docs/@catbee/utils/modules/url) | URL parsing, query manipulation, normalization |
104
+ | [Validate Utilities](https://catbee.npm.hprasath.com/docs/@catbee/utils/modules/validation) | Input validation functions |
105
105
 
106
106
  ---
107
107
 
@@ -117,10 +117,10 @@ import { chunk, sleep, TTLCache, getLogger } from "@catbee/utils";
117
117
 
118
118
  ## 📖 Documentation
119
119
 
120
- - [Full API Docs & Examples](https://catbee-utils.npm.hprasath.com)
120
+ - [Full API Docs & Examples](https://catbee.npm.hprasath.com/docs/@catbee/utils/intro)
121
121
 
122
122
  ---
123
123
 
124
124
  ## 📜 License
125
125
 
126
- MIT © catbee-technologies
126
+ MIT © Catbee Technologies (see the [LICENSE](https://catbee.npm.hprasath.com/license/) file for the full text)
package/build/index.cjs CHANGED
@@ -29,7 +29,7 @@ var https__default = /*#__PURE__*/_interopDefault(https);
29
29
  /*
30
30
  * The MIT License
31
31
  *
32
- * Copyright (c) 2025 Catbee Technologies. https://catbee-utils.npm.hprasath.com/license
32
+ * Copyright (c) 2025 Catbee Technologies. https://catbee.npm.hprasath.com/license
33
33
  *
34
34
  * Permission is hereby granted, free of charge, to any person obtaining a copy
35
35
  * of this software and associated documentation files (the "Software"), to deal
@@ -402,17 +402,17 @@ var Env = class _Env {
402
402
  *
403
403
  * @typeParam T - The allowed value type (string literal types).
404
404
  * @param {string} key - The environment variable key.
405
- * @param {T[]} allowedValues - Array of accepted string values.
406
405
  * @param {T} [defaultValue] - Optional fallback value.
406
+ * @param {T[]} allowedValues - Array of accepted string values.
407
407
  * @returns {T} The validated environment value.
408
408
  * @throws {Error} If missing or invalid.
409
409
  *
410
410
  * @example
411
411
  * // If LOG_LEVEL=debug
412
- * const level = Env.getEnum('LOG_LEVEL', ['debug', 'info', 'warn', 'error'] as const, 'info');
412
+ * const level = Env.getEnum('LOG_LEVEL', 'info', ['debug', 'info', 'warn', 'error'] as const);
413
413
  * // 'debug' (typed as 'debug' | 'info' | 'warn' | 'error')
414
414
  */
415
- static getEnum(key, allowedValues, defaultValue) {
415
+ static getEnum(key, defaultValue, allowedValues) {
416
416
  const value = process.env[key];
417
417
  if (!value) {
418
418
  return defaultValue;
@@ -426,15 +426,15 @@ var Env = class _Env {
426
426
  * Retrieves an enum-like numeric environment variable.
427
427
  *
428
428
  * @param {string} key - The environment variable key.
429
- * @param {number[]} allowedValues - Array of accepted values.
430
429
  * @param {number} defaultValue - Default value if not present.
430
+ * @param {number[]} allowedValues - Array of accepted values.
431
431
  * @returns {number} The validated value.
432
432
  *
433
433
  * @example
434
434
  * // If NODE_VERSION=16
435
- * const version = Env.getNumberEnum('NODE_VERSION', [14, 16, 18], 16);
435
+ * const version = Env.getNumberEnum('NODE_VERSION', 16, [14, 16, 18]);
436
436
  */
437
- static getNumberEnum(key, allowedValues, defaultValue) {
437
+ static getNumberEnum(key, defaultValue, allowedValues) {
438
438
  const value = _Env.getNumber(key, defaultValue);
439
439
  if (!allowedValues.includes(value)) {
440
440
  throw new Error(`Environment variable '${key}' must be one of: ${allowedValues.join(", ")}. Received: ${value}`);
@@ -6663,7 +6663,7 @@ var ExpressServer = class _ExpressServer {
6663
6663
  const skip = this.config.requestLogging?.ignorePaths?.(req, res);
6664
6664
  if (skip) return next();
6665
6665
  } else if (Array.isArray(this.config.requestLogging?.ignorePaths)) {
6666
- const skip = this.config.requestLogging?.ignorePaths?.includes(req.path);
6666
+ const skip = this.config.requestLogging?.ignorePaths?.some((path3) => req.path.startsWith(path3));
6667
6667
  if (skip) return next();
6668
6668
  }
6669
6669
  const logger2 = getLogger();
package/build/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  * The MIT License
3
3
  *
4
- * Copyright (c) 2025 Catbee Technologies. https://catbee-utils.npm.hprasath.com/license
4
+ * Copyright (c) 2025 Catbee Technologies. https://catbee.npm.hprasath.com/license
5
5
  *
6
6
  * Permission is hereby granted, free of charge, to any person obtaining a copy
7
7
  * of this software and associated documentation files (the "Software"), to deal
@@ -2437,30 +2437,30 @@ declare class Env {
2437
2437
  *
2438
2438
  * @typeParam T - The allowed value type (string literal types).
2439
2439
  * @param {string} key - The environment variable key.
2440
- * @param {T[]} allowedValues - Array of accepted string values.
2441
2440
  * @param {T} [defaultValue] - Optional fallback value.
2441
+ * @param {T[]} allowedValues - Array of accepted string values.
2442
2442
  * @returns {T} The validated environment value.
2443
2443
  * @throws {Error} If missing or invalid.
2444
2444
  *
2445
2445
  * @example
2446
2446
  * // If LOG_LEVEL=debug
2447
- * const level = Env.getEnum('LOG_LEVEL', ['debug', 'info', 'warn', 'error'] as const, 'info');
2447
+ * const level = Env.getEnum('LOG_LEVEL', 'info', ['debug', 'info', 'warn', 'error'] as const);
2448
2448
  * // 'debug' (typed as 'debug' | 'info' | 'warn' | 'error')
2449
2449
  */
2450
- static getEnum<T extends string>(key: string, allowedValues: readonly T[], defaultValue: T): T;
2450
+ static getEnum<T extends string>(key: string, defaultValue: T, allowedValues: readonly T[]): T;
2451
2451
  /**
2452
2452
  * Retrieves an enum-like numeric environment variable.
2453
2453
  *
2454
2454
  * @param {string} key - The environment variable key.
2455
- * @param {number[]} allowedValues - Array of accepted values.
2456
2455
  * @param {number} defaultValue - Default value if not present.
2456
+ * @param {number[]} allowedValues - Array of accepted values.
2457
2457
  * @returns {number} The validated value.
2458
2458
  *
2459
2459
  * @example
2460
2460
  * // If NODE_VERSION=16
2461
- * const version = Env.getNumberEnum('NODE_VERSION', [14, 16, 18], 16);
2461
+ * const version = Env.getNumberEnum('NODE_VERSION', 16, [14, 16, 18]);
2462
2462
  */
2463
- static getNumberEnum(key: string, allowedValues: number[], defaultValue: number): number;
2463
+ static getNumberEnum(key: string, defaultValue: number, allowedValues: number[]): number;
2464
2464
  /**
2465
2465
  * Retrieves a URL environment variable and validates it.
2466
2466
  *
package/build/index.mjs CHANGED
@@ -17,7 +17,7 @@ import https from 'https';
17
17
  /*
18
18
  * The MIT License
19
19
  *
20
- * Copyright (c) 2025 Catbee Technologies. https://catbee-utils.npm.hprasath.com/license
20
+ * Copyright (c) 2025 Catbee Technologies. https://catbee.npm.hprasath.com/license
21
21
  *
22
22
  * Permission is hereby granted, free of charge, to any person obtaining a copy
23
23
  * of this software and associated documentation files (the "Software"), to deal
@@ -390,17 +390,17 @@ var Env = class _Env {
390
390
  *
391
391
  * @typeParam T - The allowed value type (string literal types).
392
392
  * @param {string} key - The environment variable key.
393
- * @param {T[]} allowedValues - Array of accepted string values.
394
393
  * @param {T} [defaultValue] - Optional fallback value.
394
+ * @param {T[]} allowedValues - Array of accepted string values.
395
395
  * @returns {T} The validated environment value.
396
396
  * @throws {Error} If missing or invalid.
397
397
  *
398
398
  * @example
399
399
  * // If LOG_LEVEL=debug
400
- * const level = Env.getEnum('LOG_LEVEL', ['debug', 'info', 'warn', 'error'] as const, 'info');
400
+ * const level = Env.getEnum('LOG_LEVEL', 'info', ['debug', 'info', 'warn', 'error'] as const);
401
401
  * // 'debug' (typed as 'debug' | 'info' | 'warn' | 'error')
402
402
  */
403
- static getEnum(key, allowedValues, defaultValue) {
403
+ static getEnum(key, defaultValue, allowedValues) {
404
404
  const value = process.env[key];
405
405
  if (!value) {
406
406
  return defaultValue;
@@ -414,15 +414,15 @@ var Env = class _Env {
414
414
  * Retrieves an enum-like numeric environment variable.
415
415
  *
416
416
  * @param {string} key - The environment variable key.
417
- * @param {number[]} allowedValues - Array of accepted values.
418
417
  * @param {number} defaultValue - Default value if not present.
418
+ * @param {number[]} allowedValues - Array of accepted values.
419
419
  * @returns {number} The validated value.
420
420
  *
421
421
  * @example
422
422
  * // If NODE_VERSION=16
423
- * const version = Env.getNumberEnum('NODE_VERSION', [14, 16, 18], 16);
423
+ * const version = Env.getNumberEnum('NODE_VERSION', 16, [14, 16, 18]);
424
424
  */
425
- static getNumberEnum(key, allowedValues, defaultValue) {
425
+ static getNumberEnum(key, defaultValue, allowedValues) {
426
426
  const value = _Env.getNumber(key, defaultValue);
427
427
  if (!allowedValues.includes(value)) {
428
428
  throw new Error(`Environment variable '${key}' must be one of: ${allowedValues.join(", ")}. Received: ${value}`);
@@ -6651,7 +6651,7 @@ var ExpressServer = class _ExpressServer {
6651
6651
  const skip = this.config.requestLogging?.ignorePaths?.(req, res);
6652
6652
  if (skip) return next();
6653
6653
  } else if (Array.isArray(this.config.requestLogging?.ignorePaths)) {
6654
- const skip = this.config.requestLogging?.ignorePaths?.includes(req.path);
6654
+ const skip = this.config.requestLogging?.ignorePaths?.some((path3) => req.path.startsWith(path3));
6655
6655
  if (skip) return next();
6656
6656
  }
6657
6657
  const logger2 = getLogger();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@catbee/utils",
3
- "version": "1.0.3",
3
+ "version": "1.0.5",
4
4
  "description": "A modular, production-grade utility toolkit for Node.js and TypeScript, designed for robust, scalable applications (including Express-based services). All utilities are tree-shakable and can be imported independently.",
5
5
  "main": "build/index.cjs",
6
6
  "module": "build/index.mjs",