{"_id":"read-env-value","_rev":"1409989","name":"read-env-value","description":"Read env with default value","dist-tags":{"latest":"2.0.2"},"maintainers":[{"name":"fengmk2","email":"fengmk2@gmail.com"}],"time":{"modified":"2026-09-14T02:39:03.000Z","created":"2025-02-10T05:38:08.591Z","2.0.2":"2025-08-08T08:16:45.042Z","2.0.1":"2025-07-31T08:41:40.106Z","2.0.0":"2025-07-30T14:21:45.306Z","1.1.0":"2025-05-10T05:26:57.764Z","1.0.1":"2025-04-24T07:29:32.690Z","1.0.0":"2025-02-10T06:19:46.212Z","0.0.0":"2025-02-10T05:38:08.591Z"},"users":{},"author":{"name":"fengmk2"},"repository":{"type":"git","url":"git+ssh://git@github.com/node-modules/read-env-value.git"},"versions":{"2.0.2":{"name":"read-env-value","version":"2.0.2","description":"Read env with default value","repository":{"type":"git","url":"git+ssh://git@github.com/node-modules/read-env-value.git"},"keywords":["env","environment"],"author":{"name":"fengmk2"},"license":"MIT","bugs":{"url":"https://github.com/node-modules/read-env-value/issues"},"homepage":"https://github.com/node-modules/read-env-value#readme","engines":{"node":">= 22.18.0"},"devDependencies":{"@eggjs/oxlint-config":"^1.0.0","@eggjs/tsconfig":"3","@types/node":"24","c8":"10","husky":"9","mm":"4","oxlint":"1","prettier":"3","typescript":"5"},"scripts":{"lint":"oxlint","pretest":"npm run lint -- --fix","test":"node --test","preci":"npm run lint","ci":"c8 -r html -r lcov -r text npm test","postci":"npm run prepublishOnly","postversion":"npx sync-npm-version-to-jsr && git add jsr.json","prepublishOnly":"tsc -b --clean && tsc","prepare":"husky"},"lint-staged":{"*":"prettier --write --ignore-unknown --cache","*.{ts,js,json,md,yml}":["prettier --ignore-unknown --write","oxlint --fix"]},"type":"module","exports":"./dist/index.js","types":"./dist/index.d.ts","_id":"read-env-value@2.0.2","gitHead":"d543f9e78a889c36d0559a81e5e001995548fc8c","_nodeVersion":"22.17.1","_npmVersion":"11.5.2","dist":{"integrity":"sha512-Am/yEiF/miBke3cQi5OvcXpA0wPvUCNQgnAk58YibYooeQnSSPprqP0FdRsI/8uTXMF9Wc9IyGQCr4bnTxCN0w==","shasum":"c5afe7ae85a5f554e94ac6e86689bd4587c90f0d","tarball":"http://registry-npm.ywwl.com/read-env-value/download/read-env-value-2.0.2.tgz","fileCount":5,"unpackedSize":8870,"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/read-env-value@2.0.2","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIE2zSHjb4lNfEtiYB/g/i1niAbKTmL/ziIa4PAz3NUfPAiB4XqTQ2utAWS7USVIIohmUT6gO+K1cu8MGtNpa+QYscA=="}],"size":3637,"noattachment":false,"key":"/read-env-value/-/read-env-value-2.0.2.tgz"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:9c31d75e-732e-476d-aac4-d1f046e9dbb5"}},"directories":{},"maintainers":[{"name":"fengmk2","email":"fengmk2@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/read-env-value_2.0.2_1754641004856_0.5876361782014006"},"_hasShrinkwrap":false,"publish_time":1754641005042,"_cnpm_publish_time":1754641005042},"2.0.1":{"name":"read-env-value","version":"2.0.1","keywords":["env","environment"],"author":{"name":"fengmk2"},"license":"MIT","_id":"read-env-value@2.0.1","maintainers":[{"name":"fengmk2","email":"fengmk2@gmail.com"}],"homepage":"https://github.com/node-modules/read-env-value#readme","bugs":{"url":"https://github.com/node-modules/read-env-value/issues"},"dist":{"shasum":"6b956a685b184c8ad45b13f896b6791592f5fa94","tarball":"http://registry-npm.ywwl.com/read-env-value/download/read-env-value-2.0.1.tgz","fileCount":6,"integrity":"sha512-3sKLeaNpW4smWNYJpGb4Bi3t/G/BXRth9S58lq/RfpTE/Ppo1MCdxyQPMAHa+OW3uKOIsKP9Q55GSTLHab+d5A==","signatures":[{"sig":"MEUCIERjSLx8I/jg6tT66FDw0EyLyXt+Q7w3oTxHrmaAWqEaAiEA2ahJIqoglGvCROeCba62BdwrxFm+S/3nPDyZGgk8P0Y=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/read-env-value@2.0.1","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":10970,"size":3892,"noattachment":false,"key":"/read-env-value/-/read-env-value-2.0.1.tgz"},"type":"module","types":"./dist/index.d.ts","engines":{"node":">= 22.17.0"},"exports":"./dist/index.js","gitHead":"e5c9aa0d39ac840efa127b9ad687d0b9a62fbd90","scripts":{"ci":"c8 -r html -r lcov -r text npm test","lint":"oxlint","test":"node --test --experimental-strip-types","preci":"npm run lint","postci":"npm run prepublishOnly","prepare":"husky","pretest":"npm run lint -- --fix","postversion":"npx sync-npm-version-to-jsr && git add jsr.json","prepublishOnly":"tsc -b --clean && tsc"},"_npmUser":{"name":"fengmk2","email":"fengmk2@gmail.com"},"repository":{"url":"git+ssh://git@github.com/node-modules/read-env-value.git","type":"git"},"_npmVersion":"10.9.2","description":"Read env with default value","directories":{},"lint-staged":{"*":"prettier --write --ignore-unknown --cache","*.{ts,js,json,md,yml}":["prettier --ignore-unknown --write","oxlint --fix"]},"_nodeVersion":"22.17.1","_hasShrinkwrap":false,"devDependencies":{"c8":"10","mm":"4","husky":"9","oxlint":"1","prettier":"3","typescript":"5","@types/node":"24","@eggjs/tsconfig":"3"},"_npmOperationalInternal":{"tmp":"tmp/read-env-value_2.0.1_1753951299915_0.6438159269541595","host":"s3://npm-registry-packages-npm-production"},"publish_time":1753951300106,"_cnpm_publish_time":1753951300106},"2.0.0":{"name":"read-env-value","version":"2.0.0","keywords":["env","environment"],"author":{"name":"fengmk2"},"license":"MIT","_id":"read-env-value@2.0.0","maintainers":[{"name":"fengmk2","email":"fengmk2@gmail.com"}],"homepage":"https://github.com/node-modules/read-env-value#readme","bugs":{"url":"https://github.com/node-modules/read-env-value/issues"},"dist":{"shasum":"84751749868dcb353f42d1e3df67b80d16b4c2c9","tarball":"http://registry-npm.ywwl.com/read-env-value/download/read-env-value-2.0.0.tgz","fileCount":6,"integrity":"sha512-a2vpVg/zK1HMKZFelJHMMCHsWnVOU7fQbj4Br83kZZOymnyLcb3b72YaWs3L+hgej4NlbTVvIA4LjaKxZr1YfA==","signatures":[{"sig":"MEQCIHysDLOcHBN/6EfzBxVgn7nAwTXJigGUi83QuKihrHuLAiAMRV4Dz32AIPp31g8PMvvxu30gLK6ZqH6cDxBqJ0QF1Q==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/read-env-value@2.0.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":10912,"size":3859,"noattachment":false,"key":"/read-env-value/-/read-env-value-2.0.0.tgz"},"type":"module","types":"./dist/index.d.ts","engines":{"node":">= 22.17.0"},"exports":"./dist/index.js","gitHead":"9e6972cd3b392899646d2483187a74cf03671c4a","scripts":{"ci":"c8 -r html -r lcov -r text npm test","lint":"oxlint","test":"node --test --experimental-strip-types","preci":"npm run lint","postci":"npm run prepublishOnly","prepare":"husky","pretest":"npm run lint -- --fix","prepublishOnly":"tsc -b --clean && tsc"},"_npmUser":{"name":"fengmk2","email":"fengmk2@gmail.com"},"repository":{"url":"git+ssh://git@github.com/node-modules/read-env-value.git","type":"git"},"_npmVersion":"10.8.2","description":"Read env with default value","directories":{},"lint-staged":{"*":"prettier --write --ignore-unknown --cache","*.{ts,js,json,md,yml}":["prettier --ignore-unknown --write","oxlint --fix"]},"_nodeVersion":"20.19.4","_hasShrinkwrap":false,"devDependencies":{"c8":"10","mm":"4","husky":"9","oxlint":"1","prettier":"3","typescript":"5","@types/node":"24","@eggjs/tsconfig":"3"},"_npmOperationalInternal":{"tmp":"tmp/read-env-value_2.0.0_1753885305085_0.8784643901837779","host":"s3://npm-registry-packages-npm-production"},"publish_time":1753885305306,"_cnpm_publish_time":1753885305306},"1.1.0":{"name":"read-env-value","version":"1.1.0","keywords":["env","environment"],"author":{"name":"fengmk2"},"license":"MIT","_id":"read-env-value@1.1.0","maintainers":[{"name":"fengmk2","email":"fengmk2@gmail.com"}],"homepage":"https://github.com/node-modules/read-env-value#readme","bugs":{"url":"https://github.com/node-modules/read-env-value/issues"},"dist":{"shasum":"83d6062594a798c6b43bd58dcd021e9c7e91e693","tarball":"http://registry-npm.ywwl.com/read-env-value/download/read-env-value-1.1.0.tgz","fileCount":11,"integrity":"sha512-qxnfBEB28e6+x/urTVkx6nHfOOJe4sXm+zKlrQNgqvixvFkwZST7Puzq5OgdUd6mBu5Fm3eKOits67j+G4YzjQ==","signatures":[{"sig":"MEQCICtNLulmXYboUfz2F9yERtsaBW8hMjrWe0Hf9MvrNf2BAiBB8/kHM8uI0yIS41wEGHXnH3aef6kWdHc9ah1f1usk8A==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/read-env-value@1.1.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":15780,"size":4639,"noattachment":false,"key":"/read-env-value/-/read-env-value-1.1.0.tgz"},"main":"./dist/commonjs/index.js","tshy":{"exports":{".":"./src/index.ts","./package.json":"./package.json"}},"type":"module","types":"./dist/commonjs/index.d.ts","module":"./dist/esm/index.js","engines":{"node":">= 20.0.0"},"exports":{".":{"import":{"types":"./dist/esm/index.d.ts","default":"./dist/esm/index.js"},"require":{"types":"./dist/commonjs/index.d.ts","default":"./dist/commonjs/index.js"}},"./package.json":"./package.json"},"gitHead":"d97d23a0b0c03cd564b6e7f8c6ae9199bdde3892","scripts":{"ci":"vitest run --coverage","lint":"oxlint","test":"vitest run","preci":"npm run lint","postci":"npm run prepublishOnly","prepare":"husky","pretest":"npm run lint -- --fix","prepublishOnly":"tshy && tshy-after && attw --pack"},"_npmUser":{"name":"fengmk2","email":"fengmk2@gmail.com"},"repository":{"url":"git+ssh://git@github.com/node-modules/read-env-value.git","type":"git"},"_npmVersion":"10.8.2","description":"Read env with default value","directories":{},"lint-staged":{"*":"prettier --write --ignore-unknown --cache","*.{ts,js,json,md,yml}":["prettier --ignore-unknown --write","oxlint --fix"]},"_nodeVersion":"20.19.1","_hasShrinkwrap":false,"devDependencies":{"mm":"^4.0.2","tshy":"3","husky":"^9.1.7","oxlint":"^0.16.10","vitest":"^3.0.5","prettier":"^3.5.3","tshy-after":"1","typescript":"5","@types/node":"22","@eggjs/tsconfig":"1","@vitest/coverage-v8":"^3.0.5","@arethetypeswrong/cli":"^0.17.3"},"_npmOperationalInternal":{"tmp":"tmp/read-env-value_1.1.0_1746854817554_0.6109973988020487","host":"s3://npm-registry-packages-npm-production"},"publish_time":1746854817764,"_cnpm_publish_time":1746854817764},"1.0.1":{"name":"read-env-value","version":"1.0.1","keywords":["env","environment"],"author":{"name":"fengmk2"},"license":"MIT","_id":"read-env-value@1.0.1","maintainers":[{"name":"fengmk2","email":"fengmk2@gmail.com"}],"homepage":"https://github.com/node-modules/read-env-value#readme","bugs":{"url":"https://github.com/node-modules/read-env-value/issues"},"dist":{"shasum":"cd44bf3485ea3b93d89ab80310c0483589ca891d","tarball":"http://registry-npm.ywwl.com/read-env-value/download/read-env-value-1.0.1.tgz","fileCount":11,"integrity":"sha512-jTRhWXrirBKHASMH9kHGDITn4RyCsPYq4VsOgNu+wuX52aVCxWgGSjKgyLb+f4GMhdr02sXWAPhCNtjqhKjQeQ==","signatures":[{"sig":"MEQCIEW5GAfnTqd1mtQbO3OC5ZsjRZChbViRYwn/HwDA0IwvAiAriCWIlJonMNhm9Chz+HevS9fW231YjkM1gDgb87gCEg==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/read-env-value@1.0.1","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":15533,"size":4535,"noattachment":false,"key":"/read-env-value/-/read-env-value-1.0.1.tgz"},"main":"./dist/commonjs/index.js","tshy":{"exports":{".":"./src/index.ts","./package.json":"./package.json"}},"type":"module","types":"./dist/commonjs/index.d.ts","module":"./dist/esm/index.js","engines":{"node":">= 20.0.0"},"exports":{".":{"import":{"types":"./dist/esm/index.d.ts","default":"./dist/esm/index.js"},"require":{"types":"./dist/commonjs/index.d.ts","default":"./dist/commonjs/index.js"}},"./package.json":"./package.json"},"gitHead":"ef3b9b7802ab466b91fc7d12bebab53c6c1f7d60","scripts":{"ci":"vitest run --coverage","lint":"eslint --cache src test --ext .ts","test":"vitest","preci":"npm run lint","postci":"npm run prepublishOnly","pretest":"npm run lint -- --fix","prepublishOnly":"tshy && tshy-after && attw --pack"},"_npmUser":{"name":"fengmk2","email":"fengmk2@gmail.com"},"repository":{"url":"git+ssh://git@github.com/node-modules/read-env-value.git","type":"git"},"_npmVersion":"10.8.2","description":"Read env with default value","directories":{},"_nodeVersion":"20.19.0","_hasShrinkwrap":false,"devDependencies":{"mm":"^4.0.2","tshy":"3","eslint":"8","vitest":"^3.0.5","tshy-after":"1","typescript":"5","@types/node":"22","@eggjs/tsconfig":"1","eslint-config-egg":"14","@vitest/coverage-v8":"^3.0.5","@arethetypeswrong/cli":"^0.17.3"},"_npmOperationalInternal":{"tmp":"tmp/read-env-value_1.0.1_1745479772522_0.9887431452786384","host":"s3://npm-registry-packages-npm-production"},"publish_time":1745479772690,"_cnpm_publish_time":1745479772690},"1.0.0":{"name":"read-env-value","version":"1.0.0","keywords":["env","environment"],"author":{"name":"fengmk2"},"license":"MIT","_id":"read-env-value@1.0.0","maintainers":[{"name":"fengmk2","email":"fengmk2@gmail.com"}],"homepage":"https://github.com/node-modules/read-env-value#readme","bugs":{"url":"https://github.com/node-modules/read-env-value/issues"},"dist":{"shasum":"19f86ecf12fa15c5b550e77a3acb0b5cd907df4f","tarball":"http://registry-npm.ywwl.com/read-env-value/download/read-env-value-1.0.0.tgz","fileCount":11,"integrity":"sha512-jgRep8JcR/tWGhG7ih1Q4jA2ib4ucrikA9fdWH8IRYHbcUxa55Lh7YvdWa3IxZ41tzzfDmCHqquR0KWG2ERNAQ==","signatures":[{"sig":"MEQCIGt7uItbZ0fxZz8xUT6KWr7NG1L9986lWiyKg9PiDkqOAiBBywQqnTAPrK8LkMEGSn2NSeCENnTJFVxHBn7M0t49MQ==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/read-env-value@1.0.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":12509,"size":3941,"noattachment":false,"key":"/read-env-value/-/read-env-value-1.0.0.tgz"},"main":"./dist/commonjs/index.js","tshy":{"exports":{".":"./src/index.ts","./package.json":"./package.json"}},"type":"module","types":"./dist/commonjs/index.d.ts","module":"./dist/esm/index.js","engines":{"node":">= 20.0.0"},"exports":{".":{"import":{"types":"./dist/esm/index.d.ts","default":"./dist/esm/index.js"},"require":{"types":"./dist/commonjs/index.d.ts","default":"./dist/commonjs/index.js"}},"./package.json":"./package.json"},"gitHead":"ed90cced7b8695969d6e31a3ec6545c71fa1aa4c","scripts":{"ci":"vitest run --coverage","lint":"eslint --cache src test --ext .ts","test":"vitest","preci":"npm run lint","postci":"npm run prepublishOnly","pretest":"npm run lint -- --fix","prepublishOnly":"tshy && tshy-after && attw --pack"},"_npmUser":{"name":"fengmk2","email":"fengmk2@gmail.com"},"repository":{"url":"git+ssh://git@github.com/node-modules/read-env-value.git","type":"git"},"_npmVersion":"10.8.2","description":"Read env with default value","directories":{},"_nodeVersion":"20.18.2","_hasShrinkwrap":false,"devDependencies":{"mm":"^4.0.2","tshy":"3","eslint":"8","vitest":"^3.0.5","tshy-after":"1","typescript":"5","@types/node":"22","@eggjs/tsconfig":"1","eslint-config-egg":"14","@vitest/coverage-v8":"^3.0.5","@arethetypeswrong/cli":"^0.17.3"},"_npmOperationalInternal":{"tmp":"tmp/read-env-value_1.0.0_1739168386029_0.9270971859283075","host":"s3://npm-registry-packages-npm-production"},"publish_time":1739168386212,"_cnpm_publish_time":1739168386212},"0.0.0":{"name":"read-env-value","version":"0.0.0","keywords":["env"],"author":{"name":"fengmk2"},"license":"MIT","_id":"read-env-value@0.0.0","maintainers":[{"name":"fengmk2","email":"fengmk2@gmail.com"}],"dist":{"shasum":"6277818d50a42f434692eb8c6c77824a79d257a2","tarball":"http://registry-npm.ywwl.com/read-env-value/download/read-env-value-0.0.0.tgz","fileCount":1,"integrity":"sha512-Pr87e+DSkIYdfMPAH6FaVwfYXI5cj2rXB9QpiHjviqkGED1bvZtGAectsLF4TCRzKiDl/KRBUKUmgh2GWhnIvQ==","signatures":[{"sig":"MEUCIQCqU1i+ize3pjHxs7VqrBnnmPlDIjK71qBB6tm/+043cgIgLfcTaf7uuPiOKbm+M4sxI6IN2EWFBC2N40S8G5KL5C0=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":241,"size":256,"noattachment":false,"key":"/read-env-value/-/read-env-value-0.0.0.tgz"},"main":"index.js","scripts":{"test":"node test"},"_npmUser":{"name":"fengmk2","email":"fengmk2@gmail.com"},"_npmVersion":"10.9.2","description":"Read env with default value","directories":{},"_nodeVersion":"22.13.1","_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/read-env-value_0.0.0_1739165888408_0.4700211299740429","host":"s3://npm-registry-packages-npm-production"},"publish_time":1739165888591,"_cnpm_publish_time":1739165888591}},"readme":"# read-env-value\n\n[![NPM Version](https://img.shields.io/npm/v/read-env-value)](https://www.npmjs.com/package/read-env-value)\n[![NPM Downloads](https://img.shields.io/npm/dm/read-env-value)](https://www.npmjs.com/package/read-env-value)\n[![NPM License](https://img.shields.io/npm/l/read-env-value)](https://github.com/node-modules/read-env-value/blob/master/LICENSE)\n[![JSR](https://jsr.io/badges/@nm/read-env-value)](https://jsr.io/@nm/read-env-value)\n[![JSR Score](https://jsr.io/badges/@nm/read-env-value/score)](https://jsr.io/@nm/read-env-value)\n[![codecov](https://codecov.io/gh/node-modules/read-env-value/branch/master/graph/badge.svg)](https://codecov.io/gh/node-modules/read-env-value)\n[![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/node-modules/read-env-value/ci.yml?branch=master)](https://github.com/node-modules/read-env-value/actions/workflows/ci.yml?query=branch%3Amaster)\n[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](https://makeapullrequest.com)\n![CodeRabbit Pull Request Reviews](https://img.shields.io/coderabbit/prs/github/node-modules/read-env-value)\n\nRead env with default value\n\n## Usage\n\n```ts\nimport { env } from 'read-env-value';\n\n// read env 'NODE_ENV' with default value 'development'\nconst value = env('NODE_ENV', 'string', 'development');\n```\n\n## API\n\n### env(key: string, type: 'string' | 'number' | 'boolean', defaultValue?: string | number | boolean)\n\n#### Parameters\n\n- `key`: The environment variable key to read.\n- `type`: The type of the value to be returned.\n- `defaultValue`: The default value to return if the environment variable is not set.\n\n#### Returns\n\n- The value of the environment variable.\n\n#### Example\n\n```ts\nimport { env } from 'read-env-value';\n\nconst value = env('NODE_ENV', 'string', 'development');\n```\n\n## License\n\n[MIT](./LICENSE)\n\n## Contributors\n\n[![Contributors](https://contrib.rocks/image?repo=node-modules/read-env-value)](https://github.com/node-modules/read-env-value/graphs/contributors)\n\nMade with [contributors-img](https://contrib.rocks).\n","_attachments":{},"homepage":"https://github.com/node-modules/read-env-value#readme","bugs":{"url":"https://github.com/node-modules/read-env-value/issues"},"license":"MIT"}