@cripty2001/utils 0.0.28 → 0.0.29

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/index.d.ts CHANGED
@@ -29,3 +29,5 @@ export declare function parseQuery(query: string | Record<string, any> | URLSear
29
29
  left: URLSearchParams;
30
30
  };
31
31
  export declare function randBetween(min: number, max: number): number;
32
+ import "dotenv/config";
33
+ export declare function getEnv(key: string, defaultValue: string | undefined): string;
package/dist/index.js CHANGED
@@ -13,6 +13,7 @@ exports.download = download;
13
13
  exports.stableLog = stableLog;
14
14
  exports.parseQuery = parseQuery;
15
15
  exports.randBetween = randBetween;
16
+ exports.getEnv = getEnv;
16
17
  const lodash_1 = require("lodash");
17
18
  function getRandom(_alphabeth, length) {
18
19
  const alphabeth = _alphabeth.split("");
@@ -134,3 +135,10 @@ function parseQuery(query, fields) {
134
135
  function randBetween(min, max) {
135
136
  return Math.floor(Math.random() * (max - min + 1)) + min;
136
137
  }
138
+ require("dotenv/config");
139
+ function getEnv(key, defaultValue) {
140
+ const value = process.env[key] ?? defaultValue;
141
+ if (value === undefined)
142
+ throw new Error(`Environment variable ${key} is not defined and no default value was provided.`);
143
+ return value;
144
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cripty2001/utils",
3
- "version": "0.0.28",
3
+ "version": "0.0.29",
4
4
  "description": "Internal Set of utils. If you need them use them, otherwise go to the next package ;)",
5
5
  "homepage": "https://github.com/cripty2001/utils#readme",
6
6
  "bugs": {
@@ -22,6 +22,7 @@
22
22
  "dist"
23
23
  ],
24
24
  "devDependencies": {
25
+ "@types/node": "^24.9.1",
25
26
  "@types/react": "^19",
26
27
  "react": "^19",
27
28
  "typescript": "^5.9.3"
@@ -29,6 +30,7 @@
29
30
  "dependencies": {
30
31
  "@cripty2001/whispr": "^0.1.0",
31
32
  "@types/lodash": "^4.17.20",
33
+ "dotenv": "^17.2.3",
32
34
  "lodash": "^4.17.21"
33
35
  },
34
36
  "peerDependencies": {