{"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,"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","publish_time":1754641005042,"_cnpm_publish_time":1754641005042,"dist-tags":{"latest":"2.0.2"}}