processenv
Advanced tools
Comparing version 3.0.2 to 3.0.3
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.normalize = void 0; | ||
const normalize = function (value) { | ||
@@ -7,3 +8,3 @@ try { | ||
} | ||
catch (ex) { | ||
catch { | ||
return value; | ||
@@ -10,0 +11,0 @@ } |
@@ -1,2 +0,2 @@ | ||
declare type EnvironmentVariableValue = undefined | string | number | boolean | object | any[]; | ||
declare type EnvironmentVariableValue = undefined | string | number | boolean | Record<string, unknown> | any[]; | ||
declare function processenv(): Record<string, EnvironmentVariableValue>; | ||
@@ -3,0 +3,0 @@ declare function processenv(key: string, defaultValue: (() => Promise<EnvironmentVariableValue>)): Promise<EnvironmentVariableValue>; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.processenv = void 0; | ||
const normalize_1 = require("./normalize"); | ||
function processenv(key, defaultValue) { | ||
/* eslint-disable no-redeclare */ | ||
if (!key) { | ||
const environmentVariables = {}; | ||
/* eslint-disable no-process-env */ | ||
// eslint-disable-next-line no-process-env | ||
Object.keys(process.env).forEach((name) => { | ||
// eslint-disable-next-line no-process-env | ||
environmentVariables[name] = normalize_1.normalize(process.env[name]); | ||
}); | ||
/* eslint-enable no-process-env */ | ||
return environmentVariables; | ||
} | ||
/* eslint-disable no-process-env */ | ||
// eslint-disable-next-line no-process-env | ||
const value = process.env[key]; | ||
/* eslint-enable no-process-env */ | ||
if (value === undefined) { | ||
@@ -18,0 +19,0 @@ if (typeof defaultValue === 'function') { |
@@ -0,1 +1,8 @@ | ||
## [3.0.3](https://github.com/thenativeweb/processenv/compare/3.0.2...3.0.3) (2020-11-03) | ||
### Bug Fixes | ||
* Fix headline for robot section in readme. ([#239](https://github.com/thenativeweb/processenv/issues/239)) ([14bb42b](https://github.com/thenativeweb/processenv/commit/14bb42bed77363918dab1d75711f32aff74287c4)) | ||
## [3.0.2](https://github.com/thenativeweb/processenv/compare/3.0.1...3.0.2) (2020-04-30) | ||
@@ -2,0 +9,0 @@ |
const normalize = function (value: any): any { | ||
try { | ||
return JSON.parse(value); | ||
} catch (ex) { | ||
} catch { | ||
return value; | ||
@@ -6,0 +6,0 @@ } |
import { normalize } from './normalize'; | ||
type EnvironmentVariableValue = undefined | string | number | boolean | object | any[]; | ||
type EnvironmentVariableValue = undefined | string | number | boolean | Record<string, unknown> | any[]; | ||
/* eslint-disable func-style */ | ||
/* eslint-disable func-style, no-redeclare */ | ||
function processenv (): Record<string, EnvironmentVariableValue>; | ||
@@ -10,10 +10,11 @@ function processenv (key: string, defaultValue: (() => Promise<EnvironmentVariableValue>)): Promise<EnvironmentVariableValue>; | ||
function processenv (key?: any, defaultValue?: any): any { | ||
/* eslint-disable no-redeclare */ | ||
if (!key) { | ||
const environmentVariables: NodeJS.ProcessEnv = {}; | ||
/* eslint-disable no-process-env */ | ||
// eslint-disable-next-line no-process-env | ||
Object.keys(process.env).forEach((name: string): void => { | ||
// eslint-disable-next-line no-process-env | ||
environmentVariables[name] = normalize(process.env[name]); | ||
}); | ||
/* eslint-enable no-process-env */ | ||
@@ -23,5 +24,4 @@ return environmentVariables; | ||
/* eslint-disable no-process-env */ | ||
// eslint-disable-next-line no-process-env | ||
const value = process.env[key]; | ||
/* eslint-enable no-process-env */ | ||
@@ -28,0 +28,0 @@ if (value === undefined) { |
The MIT License (MIT) | ||
Copyright (c) 2015-2018 the native web. | ||
Copyright (c) 2015-2020 the native web. | ||
@@ -4,0 +4,0 @@ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: |
{ | ||
"name": "processenv", | ||
"version": "3.0.2", | ||
"version": "3.0.3", | ||
"description": "processenv parses environment variables.", | ||
@@ -27,7 +27,8 @@ "contributors": [ | ||
"devDependencies": { | ||
"assertthat": "5.1.1", | ||
"nodeenv": "3.0.0", | ||
"roboter": "11.1.19", | ||
"semantic-release-configuration": "1.0.19", | ||
"uuidv4": "6.0.8" | ||
"@types/uuid": "8.3.0", | ||
"assertthat": "5.2.1", | ||
"nodeenv": "3.0.25", | ||
"roboter": "11.5.1", | ||
"semantic-release-configuration": "1.0.24", | ||
"uuid": "8.3.1" | ||
}, | ||
@@ -34,0 +35,0 @@ "repository": { |
@@ -83,5 +83,5 @@ # processenv | ||
## Running the build | ||
## Running quality assurance | ||
To build this module use [roboter](https://www.npmjs.com/package/roboter). | ||
To run quality assurance for this module use [roboter](https://www.npmjs.com/package/roboter): | ||
@@ -88,0 +88,0 @@ ```shell |
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
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
10232
101
6