@ginimessersmith/env-cast 1.0.1 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +52 -1
  2. package/package.json +10 -2
package/README.md CHANGED
@@ -1 +1,52 @@
1
- # env-cast
1
+
2
+ # EnvCast
3
+
4
+ Zero-dependency, strictly typed environment variable parser and validator for Node.js.
5
+
6
+ [![npm version](https://img.shields.io/npm/v/@ginimessersmith/env-cast.svg)](https://www.npmjs.com/package/@ginimessersmith/env-cast)
7
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
8
+
9
+ ## Features
10
+
11
+ - **Zero Dependencies:** Ultra-lightweight and fast.
12
+ - **Type-Safe:** Written in TypeScript with full autocompletion support.
13
+ - **Fail-Fast Validation:** Strict parsing for strings, numbers, booleans, and JSON.
14
+ - **Dual Build:** Supports both CommonJS (`require`) and ESM (`import`).
15
+
16
+ ## Installation
17
+
18
+ ```bash
19
+ npm install @ginimessersmith/env-cast
20
+ ```
21
+ ## Usage
22
+ ### With TypeScript / ESM
23
+ ```typescript
24
+ import { createEnv } from '@ginimessersmith/env-cast';
25
+
26
+ // Parse and validate your environment variables
27
+ const env = createEnv({
28
+ PORT: { type: 'number', default: 3000 },
29
+ DATABASE_URL: { type: 'string', required: true },
30
+ IS_PROD: { type: 'boolean', default: false },
31
+ FEATURES: { type: 'json' }
32
+ });
33
+
34
+ console.log(`Server running on port ${env.PORT}`);
35
+ // env.PORT is strictly typed as a number!
36
+ ```
37
+
38
+ ### With JavaScript (CommonJS)
39
+ ```javascript
40
+ const { createEnv } = require('@ginimessersmith/env-cast');
41
+
42
+ // Validation and casting works perfectly in vanilla JS too!
43
+ const env = createEnv({
44
+ PORT: { type: 'number', default: 3000 },
45
+ DATABASE_URL: { type: 'string', required: true },
46
+ IS_PROD: { type: 'boolean', default: false }
47
+ });
48
+
49
+ console.log(`Server running on port ${env.PORT}`);
50
+ ```
51
+ ## Author
52
+ Crafted with precision by @ginimessersmith
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ginimessersmith/env-cast",
3
- "version": "1.0.1",
3
+ "version": "1.0.2",
4
4
  "description": "Zero-dependency, strictly typed environment variable parser and validator.",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",
@@ -40,5 +40,13 @@
40
40
  "tsup": "^8.5.1",
41
41
  "typescript": "^5.9.3",
42
42
  "vitest": "^4.0.18"
43
- }
43
+ },
44
+ "repository": {
45
+ "type": "git",
46
+ "url": "git+https://github.com/ginimessersmith/env-cast.git"
47
+ },
48
+ "bugs": {
49
+ "url": "https://github.com/ginimessersmith/env-cast/issues"
50
+ },
51
+ "homepage": "https://github.com/ginimessersmith/env-cast#readme"
44
52
  }