@axah/env-utils
Advanced tools
Comparing version 2.0.3 to 2.1.0
@@ -6,1 +6,2 @@ export { parseBooleanFromEnv } from './parse-env-variable/parse-boolean'; | ||
export { parseStringFromEnv } from './parse-env-variable/parse-string'; | ||
export { parseJsonStringFromEnv } from './parse-env-variable/parse-json-string'; |
"use strict"; | ||
/* eslint-disable import/no-unused-modules */ | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.parseStringFromEnv = exports.parseIntegerFromEnv = exports.parseFloatFromEnv = exports.parseDateFromEnv = exports.parseBooleanFromEnv = void 0; | ||
exports.parseJsonStringFromEnv = exports.parseStringFromEnv = exports.parseIntegerFromEnv = exports.parseFloatFromEnv = exports.parseDateFromEnv = exports.parseBooleanFromEnv = void 0; | ||
var parse_boolean_1 = require("./parse-env-variable/parse-boolean"); | ||
@@ -15,2 +15,4 @@ Object.defineProperty(exports, "parseBooleanFromEnv", { enumerable: true, get: function () { return parse_boolean_1.parseBooleanFromEnv; } }); | ||
Object.defineProperty(exports, "parseStringFromEnv", { enumerable: true, get: function () { return parse_string_1.parseStringFromEnv; } }); | ||
var parse_json_string_1 = require("./parse-env-variable/parse-json-string"); | ||
Object.defineProperty(exports, "parseJsonStringFromEnv", { enumerable: true, get: function () { return parse_json_string_1.parseJsonStringFromEnv; } }); | ||
//# sourceMappingURL=main.js.map |
@@ -1,2 +0,1 @@ | ||
declare type ParseType = string | number | boolean | Date; | ||
/** | ||
@@ -7,3 +6,3 @@ * Empty strings are not allowed, because openshift removes empty values in the yaml-file, | ||
export declare const isEnvValueEmpty: (key: string) => boolean; | ||
export declare const throwErrorCannotBeParsed: <T extends ParseType>(key: string, value: T) => never; | ||
export declare const throwErrorCannotBeParsed: <T>(key: string, value: T) => never; | ||
/** | ||
@@ -13,3 +12,2 @@ * Convenience function which returns the localFallback, | ||
*/ | ||
export declare const getLocalFallbackIfNotProduction: <T extends ParseType>(key: string, localFallback: T) => T; | ||
export {}; | ||
export declare const getLocalFallbackIfNotProduction: <T>(key: string, localFallback: T) => T; |
@@ -8,6 +8,8 @@ "use strict"; | ||
*/ | ||
exports.isEnvValueEmpty = (key) => process.env[key] === undefined || process.env[key] === null || process.env[key] === ''; | ||
exports.throwErrorCannotBeParsed = (key, value) => { | ||
const isEnvValueEmpty = (key) => process.env[key] === undefined || process.env[key] === null || process.env[key] === ''; | ||
exports.isEnvValueEmpty = isEnvValueEmpty; | ||
const throwErrorCannotBeParsed = (key, value) => { | ||
throw new Error(`Could not read the env-variable ${key}, because the value "${value}" cannot be parsed.`); | ||
}; | ||
exports.throwErrorCannotBeParsed = throwErrorCannotBeParsed; | ||
/** | ||
@@ -17,3 +19,3 @@ * Convenience function which returns the localFallback, | ||
*/ | ||
exports.getLocalFallbackIfNotProduction = (key, localFallback) => { | ||
const getLocalFallbackIfNotProduction = (key, localFallback) => { | ||
if (process.env.NODE_ENV === 'production') { | ||
@@ -24,2 +26,3 @@ throw new Error(`The environment variable ${key} has not been defined or is empty.`); | ||
}; | ||
exports.getLocalFallbackIfNotProduction = getLocalFallbackIfNotProduction; | ||
//# sourceMappingURL=utils.js.map |
{ | ||
"name": "@axah/env-utils", | ||
"version": "2.0.3", | ||
"version": "2.1.0", | ||
"main": "lib/main.js", | ||
@@ -23,19 +23,19 @@ "license": "UNLICENSED", | ||
"devDependencies": { | ||
"@types/jest": "^26.0.13", | ||
"@types/node": "^14.10.1", | ||
"@typescript-eslint/eslint-plugin": "^4.1.0", | ||
"@typescript-eslint/parser": "^4.1.0", | ||
"eslint": "^7.9.0", | ||
"eslint-config-airbnb-base": "^14.2.0", | ||
"eslint-config-prettier": "^6.11.0", | ||
"eslint-plugin-import": "^2.22.0", | ||
"eslint-plugin-prettier": "^3.1.4", | ||
"flowgen": "^1.11.0", | ||
"jest": "^26.4.2", | ||
"nodemon": "^2.0.4", | ||
"@types/jest": "^26.0.19", | ||
"@types/node": "^14.14.14", | ||
"@typescript-eslint/eslint-plugin": "^4.10.0", | ||
"@typescript-eslint/parser": "^4.10.0", | ||
"eslint": "^7.16.0", | ||
"eslint-config-airbnb-base": "^14.2.1", | ||
"eslint-config-prettier": "^7.1.0", | ||
"eslint-plugin-import": "^2.22.1", | ||
"eslint-plugin-prettier": "^3.3.0", | ||
"flowgen": "^1.12.1", | ||
"jest": "^26.6.3", | ||
"nodemon": "^2.0.6", | ||
"npm-run-all": "^4.1.5", | ||
"prettier": "^2.1.1", | ||
"ts-jest": "^26.3.0", | ||
"prettier": "^2.2.1", | ||
"ts-jest": "^26.4.4", | ||
"typescript": "^4.0.3" | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
17748
34
159
8
1