@kikiutils/shared 13.0.0 → 13.0.1

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/dist/env.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"env.js","names":[],"sources":["../src/env.ts"],"sourcesContent":["/**\n * Custom error class for handling missing environment variables.\n *\n * Extends the built-in `Error` class and includes the missing key.\n *\n * @extends {Error}\n */\nexport class EnvironmentNotFoundError extends Error {\n readonly key: string;\n\n /**\n * Creates a new EnvironmentNotFoundError.\n *\n * @param {string} key - The missing environment variable key\n */\n constructor(key: string) {\n super(`Missing environment variable: ${key}`);\n this.key = key;\n this.name = this.constructor.name;\n Error.captureStackTrace?.(this, this.constructor);\n }\n}\n\n/**\n * Retrieves the value of an environment variable, or throws an error if it is not defined.\n *\n * Only checks for `process.env[key] === undefined`. An empty string (e.g. '') or any falsy string\n * value like `'0'` or `'false'` is considered a valid (defined) value.\n *\n * @param {string} key - The environment variable key to retrieve\n *\n * @returns {string} The value of the environment variable\n *\n * @throws {EnvironmentNotFoundError} If the environment variable is not defined\n *\n * @example\n * ```typescript\n * process.env.API_KEY = '';\n * checkAndGetEnvValue('API_KEY'); // ✅ Returns '' (still considered \"defined\")\n *\n * delete process.env.API_KEY;\n * checkAndGetEnvValue('API_KEY'); // ❌ Throws EnvironmentNotFoundError\n * ```\n */\nexport function checkAndGetEnvValue(key: string): string {\n if (process.env[key] === undefined) throw new EnvironmentNotFoundError(key);\n return process.env[key];\n}\n"],"mappings":";;;;;;;;AAOA,IAAa,2BAAb,cAA8C,MAAM;CAChD,AAAS;;;;;;CAOT,YAAY,KAAa;AACrB,QAAM,iCAAiC,MAAM;AAC7C,OAAK,MAAM;AACX,OAAK,OAAO,KAAK,YAAY;AAC7B,QAAM,oBAAoB,MAAM,KAAK,YAAY;;;;;;;;;;;;;;;;;;;;;;;;AAyBzD,SAAgB,oBAAoB,KAAqB;AACrD,KAAI,QAAQ,IAAI,SAAS,OAAW,OAAM,IAAI,yBAAyB,IAAI;AAC3E,QAAO,QAAQ,IAAI"}
1
+ {"version":3,"file":"env.js","names":[],"sources":["../src/env.ts"],"sourcesContent":["/**\n * Custom error class for handling missing environment variables.\n *\n * Extends the built-in `Error` class and includes the missing key.\n *\n * @extends {Error}\n */\nexport class EnvironmentNotFoundError extends Error {\n readonly key: string;\n\n /**\n * Creates a new EnvironmentNotFoundError.\n *\n * @param {string} key - The missing environment variable key\n */\n constructor(key: string) {\n super(`Missing environment variable: ${key}`);\n this.key = key;\n this.name = this.constructor.name;\n Error.captureStackTrace?.(this, this.constructor);\n }\n}\n\n/**\n * Retrieves the value of an environment variable, or throws an error if it is not defined.\n *\n * Only checks for `process.env[key] === undefined`. An empty string (e.g. '') or any falsy string\n * value like `'0'` or `'false'` is considered a valid (defined) value.\n *\n * @param {string} key - The environment variable key to retrieve\n *\n * @returns {string} The value of the environment variable\n *\n * @throws {EnvironmentNotFoundError} If the environment variable is not defined\n *\n * @example\n * ```typescript\n * process.env.API_KEY = '';\n * checkAndGetEnvValue('API_KEY'); // ✅ Returns '' (still considered \"defined\")\n *\n * delete process.env.API_KEY;\n * checkAndGetEnvValue('API_KEY'); // ❌ Throws EnvironmentNotFoundError\n * ```\n */\nexport function checkAndGetEnvValue(key: string) {\n if (process.env[key] === undefined) throw new EnvironmentNotFoundError(key);\n return process.env[key];\n}\n"],"mappings":";;;;;;;;AAOA,IAAa,2BAAb,cAA8C,MAAM;CAChD,AAAS;;;;;;CAOT,YAAY,KAAa;AACrB,QAAM,iCAAiC,MAAM;AAC7C,OAAK,MAAM;AACX,OAAK,OAAO,KAAK,YAAY;AAC7B,QAAM,oBAAoB,MAAM,KAAK,YAAY;;;;;;;;;;;;;;;;;;;;;;;;AAyBzD,SAAgB,oBAAoB,KAAa;AAC7C,KAAI,QAAQ,IAAI,SAAS,OAAW,OAAM,IAAI,yBAAyB,IAAI;AAC3E,QAAO,QAAQ,IAAI"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@kikiutils/shared",
3
3
  "type": "module",
4
- "version": "13.0.0",
4
+ "version": "13.0.1",
5
5
  "description": "A lightweight and modular utility library for modern JavaScript and TypeScript — includes secure hashing, flexible logging, datetime tools, Vue/web helpers, storage abstraction, and more.",
6
6
  "author": "kiki-kanri",
7
7
  "license": "MIT",
@@ -143,8 +143,8 @@
143
143
  },
144
144
  "devDependencies": {
145
145
  "@kikiutils/changelogen": "^0.9.0",
146
- "@kikiutils/eslint-config": "^2.1.1",
147
- "@kikiutils/tsconfigs": "^5.0.4",
146
+ "@kikiutils/eslint-config": "^3.0.1",
147
+ "@kikiutils/tsconfigs": "^5.0.5",
148
148
  "@noble/hashes": "^2.0.0",
149
149
  "@types/node": "^24.3.3",
150
150
  "@vitest/coverage-v8": "^3.2.4",
package/src/env.ts CHANGED
@@ -42,7 +42,7 @@ export class EnvironmentNotFoundError extends Error {
42
42
  * checkAndGetEnvValue('API_KEY'); // ❌ Throws EnvironmentNotFoundError
43
43
  * ```
44
44
  */
45
- export function checkAndGetEnvValue(key: string): string {
45
+ export function checkAndGetEnvValue(key: string) {
46
46
  if (process.env[key] === undefined) throw new EnvironmentNotFoundError(key);
47
47
  return process.env[key];
48
48
  }