@efebia/env-loader 0.0.3 → 0.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/lib/client.js CHANGED
@@ -43,6 +43,8 @@ class EnvironmentClient {
43
43
  const value = this.getKey(key);
44
44
  values = Object.assign(Object.assign({}, values), { [key]: value, [(0, utils_1.convertToCamelCase)(key)]: value });
45
45
  }
46
+ if (listKeys.length === 1)
47
+ return values[listKeys[0]];
46
48
  return values;
47
49
  }
48
50
  ;
package/lib/index.d.ts CHANGED
@@ -2,5 +2,5 @@ import EnvironmentClient from "./client";
2
2
  import ProcessEnvStorageEnvironmentClient from "./processEnv";
3
3
  import { EnvSchema } from "./utils";
4
4
  declare const jsonProcessEnvKeyLoader: (key: string) => () => any;
5
- declare const yamlFileKeyLoader: (filePath: string) => () => unknown;
5
+ declare const yamlFileKeyLoader: (yamlContent: string) => () => unknown;
6
6
  export { EnvironmentClient, ProcessEnvStorageEnvironmentClient, EnvSchema, jsonProcessEnvKeyLoader, yamlFileKeyLoader };
package/lib/index.js CHANGED
@@ -11,5 +11,5 @@ const processEnv_1 = __importDefault(require("./processEnv"));
11
11
  exports.ProcessEnvStorageEnvironmentClient = processEnv_1.default;
12
12
  const jsonProcessEnvKeyLoader = (key) => () => JSON.parse(process.env[key]);
13
13
  exports.jsonProcessEnvKeyLoader = jsonProcessEnvKeyLoader;
14
- const yamlFileKeyLoader = (filePath) => () => js_yaml_1.default.load(filePath);
14
+ const yamlFileKeyLoader = (yamlContent) => () => js_yaml_1.default.load(yamlContent);
15
15
  exports.yamlFileKeyLoader = yamlFileKeyLoader;
package/lib/processEnv.js CHANGED
@@ -18,12 +18,8 @@ const tryParseInt = (value) => {
18
18
  return null;
19
19
  };
20
20
  const tryParseFloat = (value) => {
21
- try {
22
- return parseFloat(value);
23
- }
24
- catch (_a) {
25
- return null;
26
- }
21
+ const parsed = parseFloat(value);
22
+ return isNaN(parsed) ? null : parsed;
27
23
  };
28
24
  const tryParseBoolean = (value) => {
29
25
  if (value === 'true')
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@efebia/env-loader",
3
- "version": "0.0.3",
3
+ "version": "0.0.5",
4
4
  "license": "MIT",
5
5
  "devDependencies": {
6
6
  "@types/jest": "^29.2.5",