Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More โ†’
Socket
Sign inDemoInstall
Socket

env-var

Package Overview
Dependencies
Maintainers
2
Versions
49
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

env-var - npm Package Compare versions

Comparing version 6.0.4 to 6.1.0

4

CHANGELOG.md

@@ -0,1 +1,5 @@

## 6.1.0 (20/04/20)
* Fix TS error with *extraAccessor* typings (#114)
* Add support for generic types in *asEnum* (#116)
## 6.0.4 (04/03/20)

@@ -2,0 +6,0 @@ * Fix compilation error caused by typings generic issue.

27

env-var.d.ts

@@ -28,3 +28,3 @@

*/
required: (isRequired?: boolean) => IPresentVariable<Extensions> & Extensions;
required: (isRequired?: boolean) => IPresentVariable & ExtenderType<Extensions>;

@@ -89,3 +89,3 @@ /**

/**
* Reads an environment variable as a string, then splits it on each occurence of the specified delimiter.
* Reads an environment variable as a string, then splits it on each occurrence of the specified delimiter.
* By default a comma is used as the delimiter. For example a var set to "1,2,3" would become ['1', '2', '3'].

@@ -122,3 +122,3 @@ */

*/
asEnum: (validValues: string[]) => string;
asEnum: <T extends string>(validValues: T[]) => T;
}

@@ -148,3 +148,3 @@

*/
required: (isRequired?: boolean) => IPresentVariable<Extensions> & Extensions;
required: (isRequired?: boolean) => IPresentVariable & ExtenderType<Extensions>;

@@ -209,3 +209,3 @@ /**

/**
* Reads an environment variable as a string, then splits it on each occurence of the specified delimiter.
* Reads an environment variable as a string, then splits it on each occurrence of the specified delimiter.
* By default a comma is used as the delimiter. For example a var set to "1,2,3" would become ['1', '2', '3'].

@@ -262,5 +262,5 @@ */

*/
from<T extends Extensions, K extends keyof T>(values: NodeJS.ProcessEnv, extensions?: T): IEnv<
IPresentVariable & Record<K, (...args: any[]) => ReturnType<T[K]>>,
IOptionalVariable & Record<K, (...args: any[]) => ReturnType<T[K]>|undefined>
from<T extends Extensions>(values: NodeJS.ProcessEnv, extensions?: T): IEnv<
IPresentVariable<T> & ExtenderType<T>,
IOptionalVariable<T> & ExtenderTypeOptional<T>
>;

@@ -275,2 +275,6 @@

// Used internally only to support extension fns
type ExtenderType<T> = { [P in keyof T]: (...args: any[]) => ReturnType<T[P]> }
type ExtenderTypeOptional<T> = { [P in keyof T]: (...args: any[]) => ReturnType<T[P]>|undefined }
export type Extensions = {

@@ -281,8 +285,7 @@ [key: string]: ExtensionFn<any>

export type ExtensionFn<T> = (value: string, ...args: any[]) => T
export function get(): {[varName: string]: string}
export function get(varName: string): IOptionalVariable;
export function from<T extends Extensions, K extends keyof T>(values: NodeJS.ProcessEnv, extensions?: T): IEnv<
IPresentVariable<Record<K, (...args: any[]) => ReturnType<T[K]>>> & Record<K, (...args: any[]) => ReturnType<T[K]>>,
IOptionalVariable<Record<K, (...args: any[]) => ReturnType<T[K]>|undefined>> & Record<K, (...args: any[]) => ReturnType<T[K]>|undefined>
export function from<T extends Extensions>(values: NodeJS.ProcessEnv, extensions?: T): IEnv<
IPresentVariable<T> & ExtenderType<T>,
IOptionalVariable<T> & ExtenderTypeOptional<T>
>;
{
"name": "env-var",
"version": "6.0.4",
"version": "6.1.0",
"description": "Verification, sanatization, and type coercion for environment variables in Node.js",

@@ -26,3 +26,3 @@ "main": "env-var.js",

"keywords": [
"get",
"dotenv",
"env",

@@ -55,7 +55,8 @@ "process.env",

"devDependencies": {
"@types/chai": "^4.2.10",
"@types/mocha": "^7.0.1",
"@types/node": "~13.7.0",
"@types/chai": "~4.2.10",
"@types/mocha": "~7.0.1",
"@types/node": "~13.13.0",
"bluebird": "~3.7.0",
"chai": "~4.2.0",
"conditional-type-checks": "1.0.5",
"coveralls": "~3.0.0",

@@ -62,0 +63,0 @@ "husky": "~4.2.2",

@@ -5,7 +5,7 @@ # env-var

[![NPM version](https://img.shields.io/npm/v/env-var.svg?style=flat)](https://www.npmjs.com/package/env-var)
[![TypeScript](https://badgen.net/npm/types/env-var)](http://www.typescriptlang.org/)
[![License](https://badgen.net/npm/license/env-var)](https://opensource.org/licenses/MIT)
[![Travis CI](https://travis-ci.org/evanshortiss/env-var.svg?branch=master)](https://travis-ci.org/evanshortiss/env-var)
[![Coverage Status](https://coveralls.io/repos/github/evanshortiss/env-var/badge.svg?branch=master)](https://coveralls.io/github/evanshortiss/env-var?branch=master)
[![NPM version](https://img.shields.io/npm/v/env-var.svg?style=flat)](https://www.npmjs.com/package/env-var)
[![TypeScript](https://img.shields.io/badge/%3C%2F%3E-TypeScript-blue.svg)](http://www.typescriptlang.org/)
[![npm downloads](https://img.shields.io/npm/dm/env-var.svg?style=flat)](https://www.npmjs.com/package/env-var)

@@ -12,0 +12,0 @@ [![Known Vulnerabilities](https://snyk.io//test/github/evanshortiss/env-var/badge.svg?targetFile=package.json)](https://snyk.io//test/github/evanshortiss/env-var?targetFile=package.json)

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with โšก๏ธ by Socket Inc