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

envix

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

envix - npm Package Compare versions

Comparing version 1.2.0 to 1.3.0

dist/read-float.d.ts

1

dist/index.d.ts

@@ -8,4 +8,5 @@ export * from './has';

export * from './read-int';
export * from './read-float';
export * from './read-number';
export * from './read-number-array';
export * from './write';
export declare function readArray(key: string): string[] | undefined;
export declare function readArray(key: string, alt: string[]): string[];
export * from './bool';
export * from './float';
export * from './int';
export * from './number';

2

package.json
{
"name": "envix",
"version": "1.2.0",
"version": "1.3.0",
"description": "",

@@ -5,0 +5,0 @@ "author": {

@@ -15,2 +15,10 @@ # envix ⚙️

- [Usage](#usage)
- [write](#write)
- [read](#read)
- [readArray](#read-array)
- [readBool](#read-bool)
- [readFloat](#read-float)
- [readInt](#read-int)
- [readNumber](#read-number)
- [readNumberArray](#read-number-array)
- [Contributing](#contributing)

@@ -28,2 +36,3 @@ - [License](#license)

### Write
The write method makes it possible to set an environment variable retrospectively for later accesses.

@@ -37,2 +46,5 @@ ```typescript

### Read
The read method accepts the key of the environment variable as the first argument and an
alternative value as the second argument, which is returned if the variable does not exist.
If no argument is passed, an object with all environment variables is returned.

@@ -52,2 +64,4 @@ ```typescript

### Read Array
The readArray method makes it possible to read an environment variable as a string array.
A fallback value can be defined as the second argument.
```typescript

@@ -60,5 +74,11 @@ import { readArray, write } from 'envix';

// ['bar', 'baz']
readArray('bar', ['foo']); // string[]
// ['foo']
```
### Read Bool
The readBool method makes it possible to read an environment variable as a boolean.
A fallback value can be defined as the second argument.
```typescript

@@ -71,5 +91,43 @@ import { readBool, write } from 'envix';

// true
readBool('bar', false); // boolean
// false
```
### Read Float
The readFloat method makes it possible to read an environment variable as a float.
A fallback value can be defined as the second argument.
```typescript
import { readFloat, write } from 'envix';
write('foo', '1');
readFloat('foo'); // number | undefined
// 1.0
readFloat('bar', 2.0); // number
// 2.0
```
### Read Int
The readInt method makes it possible to read an environment variable as a integer.
A fallback value can be defined as the second argument.
```typescript
import { readInt, write } from 'envix';
write('foo', '1.0');
readInt('foo'); // number | undefined
// 1
readInt('bar', 2); // number
// 2
```
### Read Number
The readNumber method makes it possible to read an environment variable as a number.
A fallback value can be defined as the second argument.
```typescript

@@ -82,5 +140,11 @@ import { readNumber, write } from 'envix';

// 1.0
readNumber('bar', 2.0); // number
// 2.0
```
### Read Number Array
The readNumberArray method makes it possible to read an environment variable as a number array.
A fallback value can be defined as the second argument.
```typescript

@@ -93,2 +157,5 @@ import { readNumberArray, write } from 'envix';

// [1.0,2.1]
readNumberArray('bar', [2,3]); // number[]
// [2,3]
```

@@ -95,0 +162,0 @@

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

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