1.2.5 • Published 1 year ago

@tailflow/dotenv v1.2.5

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

.env File Entries Manager

This package allows you to easily manage .env file entries in a type-safe manner.

Installation

npm install @tailflow/dotenv

# or

yarn add @tailflow/dotenv

Usage

let dotEnv = new DotEnv(`EXAMPLE_NUMBER_FIELD=123`);

// retrieving 
const exampleNumberEntry = dotEnv.get<number>('EXAMPLE_NUMBER_FIELD');

console.log(exampleNumberEntry.key); // string ("EXAMPLE_NUMBER_FIELD")
console.log(exampleNumberEntry.value); // number (123)
console.log(exampleNumberEntry.comment); // undefined

// setting values and comments
dotEnv.set('EXAMPLE_NUMBER_FIELD', 456);
dotEnv.setComment('EXAMPLE_NUMBER_FIELD', 'Example comment');

dotEnv.set('NEW_FIELD', 'test');

// formatting entries to string
console.log(dotEnv.toString()); // "EXAMPLE_NUMBER_FIELD=456 # Example comment\nNEWFIELD=test"
1.2.0

1 year ago

1.1.0

1 year ago

1.2.5

1 year ago

1.2.4

1 year ago

1.2.3

1 year ago

1.2.2

1 year ago

1.2.1

1 year ago

1.0.0

2 years ago