{"_id":"@briandlee/eevee","_rev":"5-dddb275540244bdaaa97cf93c2d78355","name":"@briandlee/eevee","dist-tags":{"latest":"0.1.2"},"versions":{"0.1.0":{"name":"@briandlee/eevee","version":"0.1.0","keywords":["environment variables","validation","vanilla"],"author":{"name":"Brian Lee","email":"briandl92391@gmail.com"},"license":"MIT","_id":"@briandlee/eevee@0.1.0","maintainers":[{"name":"briandlee","email":"briandl92391@gmail.com"}],"homepage":"https://github.com/brian-dlee/eevee#readme","bugs":{"url":"https://github.com/brian-dlee/eevee/issues"},"dist":{"shasum":"1ce686fcbea34c4c93f45730fc114fd403877c15","tarball":"https://registry.npmjs.org/@briandlee/eevee/-/eevee-0.1.0.tgz","fileCount":5,"integrity":"sha512-j968OMDBowjID6OfGUZaQcfH96AMgAY55z4rgSzuWK/oPla2fLifkA7BmK852W6mguPHTwYWn5BCh9PCXu0e4w==","signatures":[{"sig":"MEUCIQDkFYl+yp3IXAtxN3US1fe7Tnt9bf72AklyvWrHsWz4SgIgDM4bp+6peRU78MCHYupRAxF5IQffQD7d+UCfUdq9y3A=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":13182},"main":"dist/cjs/index.js","type":"module","module":"dist/esm/index.js","exports":{".":{"import":"./dist/esm/index.js","require":"./dist/cjs/index.js"},"./package.json":"./package.json"},"gitHead":"30ca76e3fddb9bbfa7a8485c00e0c205a4fc2904","private":false,"scripts":{"test":"jest","build":"rollup -c","check":"npm run check:lint && npm run check:types","prepare":"husky","lint:fix":"oxlint -c .oxlintrc.json --fix","check:lint":"oxlint -c .oxlintrc.json","check:types":"tsc --noEmit"},"_npmUser":{"name":"briandlee","email":"briandl92391@gmail.com"},"repository":{"url":"git+ssh://git@github.com/brian-dlee/eevee.git","type":"git"},"_npmVersion":"10.8.0","description":"A simple environment variable extraction and validation library.","directories":{},"lint-staged":{"*.ts":["oxlint","prettier"],"*.(md|js|json)":["prettier"]},"_nodeVersion":"20.10.0","_hasShrinkwrap":false,"devDependencies":{"husky":"^9.1.1","tslib":"^2.6.3","oxlint":"^0.6.1","rollup":"^4.18.1","prettier":"^3.3.3","typescript":"^5.5.3","lint-staged":"^15.2.7","@rollup/plugin-typescript":"^11.1.6"},"_npmOperationalInternal":{"tmp":"tmp/eevee_0.1.0_1721355695962_0.2256395760372858","host":"s3://npm-registry-packages"}},"0.1.0-post.0":{"name":"@briandlee/eevee","version":"0.1.0-post.0","keywords":["environment variables","validation","vanilla"],"author":{"name":"Brian Lee","email":"briandl92391@gmail.com"},"license":"MIT","_id":"@briandlee/eevee@0.1.0-post.0","maintainers":[{"name":"briandlee","email":"briandl92391@gmail.com"}],"homepage":"https://github.com/brian-dlee/eevee#readme","bugs":{"url":"https://github.com/brian-dlee/eevee/issues"},"dist":{"shasum":"f83b772bc5a7b77605dec74ada4929905af50edb","tarball":"https://registry.npmjs.org/@briandlee/eevee/-/eevee-0.1.0-post.0.tgz","fileCount":5,"integrity":"sha512-5oxnz5AFIkBFCuWUmCyibcuLKEhFqlTUezSC962zW9XmrZDqah8DN3kZIKNAthR1buco9W5zLaEK/Hw5zhSo2w==","signatures":[{"sig":"MEQCIE27uFyFpBVfHewBmEkFoAqBtNdlzbPongMvfuKZTCTQAiAMiI3AQSWSCHQMRClDbem1be0iqkoUC1dZgb9FZTZGCA==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":14008},"main":"dist/cjs/index.js","type":"module","module":"dist/esm/index.js","exports":{".":{"import":"./dist/esm/index.js","require":"./dist/cjs/index.js"},"./package.json":"./package.json"},"gitHead":"31793400631e9ad5fec8b03d08a6376ad75df6fa","private":false,"scripts":{"test":"jest","build":"rollup -c","check":"npm run check:lint && npm run check:types","prepare":"husky","lint:fix":"oxlint -c .oxlintrc.json --fix","check:lint":"oxlint -c .oxlintrc.json","check:types":"tsc --noEmit"},"_npmUser":{"name":"briandlee","email":"briandl92391@gmail.com"},"repository":{"url":"git+ssh://git@github.com/brian-dlee/eevee.git","type":"git"},"_npmVersion":"10.8.0","description":"A simple environment variable extraction and validation library.","directories":{},"lint-staged":{"*.ts":["oxlint","prettier"],"*.(md|js|json)":["prettier"]},"_nodeVersion":"20.10.0","_hasShrinkwrap":false,"devDependencies":{"jest":"^29.7.0","husky":"^9.1.1","tslib":"^2.6.3","oxlint":"^0.6.1","rollup":"^4.18.1","ts-jest":"^29.2.3","prettier":"^3.3.3","typescript":"^5.5.3","@types/jest":"^29.5.12","lint-staged":"^15.2.7","@rollup/plugin-typescript":"^11.1.6"},"_npmOperationalInternal":{"tmp":"tmp/eevee_0.1.0-post.0_1721357012385_0.3921935351840862","host":"s3://npm-registry-packages"}},"0.1.0-post.1":{"name":"@briandlee/eevee","version":"0.1.0-post.1","keywords":["environment variables","validation","vanilla"],"author":{"name":"Brian Lee","email":"briandl92391@gmail.com"},"license":"MIT","_id":"@briandlee/eevee@0.1.0-post.1","maintainers":[{"name":"briandlee","email":"briandl92391@gmail.com"}],"homepage":"https://github.com/brian-dlee/eevee#readme","bugs":{"url":"https://github.com/brian-dlee/eevee/issues"},"dist":{"shasum":"a74a8c89fc6fa60276baaad378dc5bc591aac881","tarball":"https://registry.npmjs.org/@briandlee/eevee/-/eevee-0.1.0-post.1.tgz","fileCount":5,"integrity":"sha512-nj1ELatssN/l0STsfP602UPCWEcxi7g4TYRX4OFAGDDLn2Ki8PZg+4SAI04PCREXJRzyHrjkB68/cqzo+M87RQ==","signatures":[{"sig":"MEUCIQDtKdQiHYnHSt50j+ncyL5zxefsD+ENyoTL8yt1UUTIwgIgaA8TvxgAHZ6CKaZ+gdPtPvAD+kD+qdzFXbK+ZZv4bqw=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":14009},"main":"dist/cjs/index.js","type":"module","module":"dist/esm/index.js","exports":{".":{"import":"./dist/esm/index.js","require":"./dist/cjs/index.js"},"./package.json":"./package.json"},"gitHead":"be1ad05cc7cccd7412a1bb145dd5c780ccad862d","private":false,"scripts":{"test":"jest","build":"rollup -c","check":"npm run check:lint && npm run check:types","prepare":"husky","lint:fix":"oxlint -c .oxlintrc.json --fix","check:lint":"oxlint -c .oxlintrc.json","check:types":"tsc --noEmit"},"_npmUser":{"name":"briandlee","email":"briandl92391@gmail.com"},"repository":{"url":"git+ssh://git@github.com/brian-dlee/eevee.git","type":"git"},"_npmVersion":"10.8.0","description":"A simple environment variable extraction and validation library.","directories":{},"lint-staged":{"*.ts":["oxlint","prettier"],"*.(md|js|json)":["prettier"]},"_nodeVersion":"20.10.0","_hasShrinkwrap":false,"devDependencies":{"jest":"^29.7.0","husky":"^9.1.1","tslib":"^2.6.3","oxlint":"^0.6.1","rollup":"^4.18.1","ts-jest":"^29.2.3","prettier":"^3.3.3","typescript":"^5.5.3","@types/jest":"^29.5.12","lint-staged":"^15.2.7","@rollup/plugin-typescript":"^11.1.6"},"_npmOperationalInternal":{"tmp":"tmp/eevee_0.1.0-post.1_1721357109563_0.9422804574707415","host":"s3://npm-registry-packages"}},"0.1.0-post.2":{"name":"@briandlee/eevee","version":"0.1.0-post.2","keywords":["environment variables","validation","vanilla"],"author":{"name":"Brian Lee","email":"briandl92391@gmail.com"},"license":"MIT","_id":"@briandlee/eevee@0.1.0-post.2","maintainers":[{"name":"briandlee","email":"briandl92391@gmail.com"}],"homepage":"https://github.com/brian-dlee/eevee#readme","bugs":{"url":"https://github.com/brian-dlee/eevee/issues"},"dist":{"shasum":"76001096b7f03f09dd67e3388d27060dceb2edf4","tarball":"https://registry.npmjs.org/@briandlee/eevee/-/eevee-0.1.0-post.2.tgz","fileCount":5,"integrity":"sha512-013ee/WF5ITdRYk+xxM++vGlPncs4u/kZqD2tN8mjlk7T3LlK56lBKajZezVLmsmwe7dqNFxGVnDx5rF7eWkxg==","signatures":[{"sig":"MEYCIQDvCrHDhbL51yNMp0P/Izym/gPeTiLavyhFZdCP9cLk2gIhAPtcEoom+qvKNSx9V9qh3xBlRZPqv0DakWmvKECs1Cc2","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":14009},"main":"dist/cjs/index.js","type":"module","module":"dist/esm/index.js","exports":{".":{"import":"./dist/esm/index.js","require":"./dist/cjs/index.js"},"./package.json":"./package.json"},"gitHead":"392c3434ed31eba7e1cb7d942fbf7040dec7d1e5","private":false,"scripts":{"test":"jest","build":"rollup -c","check":"npm run check:lint && npm run check:types","prepare":"husky","lint:fix":"oxlint -c .oxlintrc.json --fix","check:lint":"oxlint -c .oxlintrc.json","check:types":"tsc --noEmit"},"_npmUser":{"name":"briandlee","email":"briandl92391@gmail.com"},"repository":{"url":"git+ssh://git@github.com/brian-dlee/eevee.git","type":"git"},"_npmVersion":"10.8.0","description":"A simple environment variable extraction and validation library.","directories":{},"lint-staged":{"*.ts":["oxlint","prettier"],"*.(md|js|json)":["prettier"]},"_nodeVersion":"20.10.0","_hasShrinkwrap":false,"devDependencies":{"jest":"^29.7.0","husky":"^9.1.1","tslib":"^2.6.3","oxlint":"^0.6.1","rollup":"^4.18.1","ts-jest":"^29.2.3","prettier":"^3.3.3","typescript":"^5.5.3","@types/jest":"^29.5.12","lint-staged":"^15.2.7","@rollup/plugin-typescript":"^11.1.6"},"_npmOperationalInternal":{"tmp":"tmp/eevee_0.1.0-post.2_1721357214440_0.8353728350529108","host":"s3://npm-registry-packages"}},"0.1.1":{"name":"@briandlee/eevee","version":"0.1.1","keywords":["environment variables","validation","vanilla"],"author":{"name":"Brian Lee","email":"briandl92391@gmail.com"},"license":"MIT","_id":"@briandlee/eevee@0.1.1","maintainers":[{"name":"briandlee","email":"briandl92391@gmail.com"}],"homepage":"https://github.com/brian-dlee/eevee#readme","bugs":{"url":"https://github.com/brian-dlee/eevee/issues"},"dist":{"shasum":"186445387e0a806bab079be953b2ca5ba4b990fe","tarball":"https://registry.npmjs.org/@briandlee/eevee/-/eevee-0.1.1.tgz","fileCount":5,"integrity":"sha512-fwV7jwHDZNe/j9rO2Yhn5wacIzik2taEUjOAEjl50uC/6uJ9i9iNMJSd5ZIqeD7cimXAuZCsgCkSmE6m3RMeRA==","signatures":[{"sig":"MEQCIA2ksH4EhGK7YWjksBBG6LbcjMZ63LXJzGxLhzwaD+nlAiAdDgn0gs9plw85fPmgVh2Zto3l2TY7LhlhjMsiJq+g0Q==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":11925},"main":"dist/cjs/index.js","type":"module","types":"./dist/cjs/index.d.ts","module":"dist/esm/index.js","exports":{".":{"import":"./dist/esm/index.js","require":"./dist/cjs/index.js"},"./package.json":"./package.json"},"gitHead":"392c3434ed31eba7e1cb7d942fbf7040dec7d1e5","private":false,"scripts":{"test":"jest","build":"rm -rf dist && rollup -c","check":"npm run check:lint && npm run check:types","prepare":"husky","lint:fix":"oxlint -c .oxlintrc.json --fix","check:lint":"oxlint -c .oxlintrc.json","check:types":"tsc --noEmit"},"_npmUser":{"name":"briandlee","email":"briandl92391@gmail.com"},"repository":{"url":"git+ssh://git@github.com/brian-dlee/eevee.git","type":"git"},"_npmVersion":"10.8.0","description":"A simple environment variable extraction and validation library.","directories":{},"lint-staged":{"*.ts":["oxlint","prettier"],"*.(md|js|json)":["prettier"]},"_nodeVersion":"20.10.0","_hasShrinkwrap":false,"devDependencies":{"jest":"^29.7.0","husky":"^9.1.1","tslib":"^2.6.3","oxlint":"^0.6.1","rollup":"^4.18.1","ts-jest":"^29.2.3","prettier":"^3.3.3","typescript":"^5.5.3","@types/jest":"^29.5.12","lint-staged":"^15.2.7","rollup-plugin-dts":"^6.1.1","@rollup/plugin-typescript":"^11.1.6"},"_npmOperationalInternal":{"tmp":"tmp/eevee_0.1.1_1721922960792_0.7732952154112462","host":"s3://npm-registry-packages"}},"0.1.2":{"name":"@briandlee/eevee","version":"0.1.2","description":"A simple environment variable extraction and validation library.","main":"dist/cjs/index.js","module":"dist/esm/index.js","types":"dist/dts/index.d.ts","private":false,"exports":{".":{"require":"./dist/cjs/index.js","import":"./dist/esm/index.js","types":"./dist/dts/index.d.ts"},"./package.json":"./package.json"},"type":"module","scripts":{"build":"rm -rf dist && rollup -c","check":"npm run check:lint && npm run check:types","check:lint":"oxlint -c .oxlintrc.json","check:types":"tsc --noEmit","lint:fix":"oxlint -c .oxlintrc.json --fix","test":"jest","prepare":"husky"},"repository":{"type":"git","url":"git+ssh://git@github.com/brian-dlee/eevee.git"},"keywords":["environment variables","validation","vanilla"],"author":{"name":"Brian Lee","email":"briandl92391@gmail.com"},"license":"MIT","bugs":{"url":"https://github.com/brian-dlee/eevee/issues"},"homepage":"https://github.com/brian-dlee/eevee#readme","devDependencies":{"@rollup/plugin-typescript":"^11.1.6","@types/jest":"^29.5.12","husky":"^9.1.1","jest":"^29.7.0","lint-staged":"^15.2.7","oxlint":"^0.6.1","prettier":"^3.3.3","rollup":"^4.18.1","rollup-plugin-dts":"^6.1.1","ts-jest":"^29.2.3","tslib":"^2.6.3","typescript":"^5.5.3"},"lint-staged":{"*.ts":["oxlint","prettier"],"*.(md|js|json)":["prettier"]},"_id":"@briandlee/eevee@0.1.2","gitHead":"5e9b7f2b2e56a6b2f170b3edf818d1869174d846","_nodeVersion":"20.10.0","_npmVersion":"10.8.0","dist":{"integrity":"sha512-niE13gfGXUwWJhyrfOyQEWyYn/PuQocvc73AyEgutCGNSpqfk04xgUxV7ncGragjno+ahzHKok1+IcsKJSuUbg==","shasum":"e1c374209524e4984dc2b7233cd83c7583d070b0","tarball":"https://registry.npmjs.org/@briandlee/eevee/-/eevee-0.1.2.tgz","fileCount":6,"unpackedSize":16942,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCxOtgfZ9o/xOP40AvgXZeWXfxuWcmYkYnMjgh+E9QlGwIgOlug0OGy+784y7ETcGlctPVJuSxMHrS98YJuDYNlvHc="}]},"_npmUser":{"name":"briandlee","email":"briandl92391@gmail.com"},"directories":{},"maintainers":[{"name":"briandlee","email":"briandl92391@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/eevee_0.1.2_1721923822938_0.13780121310728033"},"_hasShrinkwrap":false}},"time":{"created":"2024-07-19T02:21:35.880Z","modified":"2024-07-25T16:10:23.307Z","0.1.0":"2024-07-19T02:21:36.197Z","0.1.0-post.0":"2024-07-19T02:43:32.589Z","0.1.0-post.1":"2024-07-19T02:45:09.765Z","0.1.0-post.2":"2024-07-19T02:46:54.605Z","0.1.1":"2024-07-25T15:56:00.980Z","0.1.2":"2024-07-25T16:10:23.136Z"},"bugs":{"url":"https://github.com/brian-dlee/eevee/issues"},"author":{"name":"Brian Lee","email":"briandl92391@gmail.com"},"license":"MIT","homepage":"https://github.com/brian-dlee/eevee#readme","keywords":["environment variables","validation","vanilla"],"repository":{"type":"git","url":"git+ssh://git@github.com/brian-dlee/eevee.git"},"description":"A simple environment variable extraction and validation library.","maintainers":[{"name":"briandlee","email":"briandl92391@gmail.com"}],"readme":"# eevee\n\nA simple, configurable environment variable reader and validator with zero dependencies.\n\nThe library is intended to be very lightweight and extensible while providing type-safety.\nAll transformers are implemented as simple functions. The library comes with a handful\nof common transformers but the intention is that you can easily add your own.\n\n## Basic Usage\n\n```typescript\nimport { asInt, ev, must, pipe } from \"eevee\";\n\nconst port: number = ev(process.env, \"PORT\", pipe(must, asInt));\n```\n\n## Using composition\n\n```typescript\nfunction validEmail(v: V<string | undefined>): V<string | undefined> => {\n  if (v.value === undefined) {\n    return v;\n  }\n  if (v.value.indexOf('@') < 0 || !/\\.[a-z]{2,}$/.test(v.value)) {\n    throw new Error(\"Value must be an email address.\");\n  }\n  return v;\n}\n\nfunction mustBeEmail(v: V<string | undefined>) {\n  return validEmail(must(v));\n}\n\nconst maybeEmail: string | undefined = ev(process.env, \"MAYBE_EMAIL\", validEmail);\nconst adminEmail: string = ev(process.env, \"ADMIN_EMAIL\", mustBeEmail);\n```\n\n## Readers\n\nA reader's job is simple - yield an environment variable value by name. The most common\nform of a reader is to read from `process.env`. The signature of all environment variables\nis a `string | undefined`. It's the job of a reader to be given a `name` and yield a\n`V<string | undefined>`. Below are two examples: one using `process.env` and another for\nNestJS's `ConfigService`.\n\n```typescript\nconst processEnvReader = (env: Record<string, string | undefined> => (name: string) => {\n  return {\n    value: env[name],\n    name,\n    secret: false,\n  };\n};\n\nconst nestConfigServiceReader = (cs: ConfigService) => (name: string) => {\n  return {\n    value: cs.get<string>(name),\n    name,\n    secret: false,\n  };\n};\n```\n\n## Appliers\n\nAn applier's job is a bit more complicated. The purpose of an applier is to intercept\na transformation and perform some side effect (like logging) during the transformation\nphase.\n\nBelow are two examples creating an applier for logging using the built-in `console` and\na third-party logger like NestJS's `Logger`. Both log errors and\npost-transformation results from environment variable parsing.\n\n```typescript\nconst consoleLoggerApplier: Applier = <T>(transform: VT<T>): VT<T> => {\n  return (v: V<string | undefined>) => {\n    let result: V<T>;\n    try {\n      result = transform(v);\n    } catch (e) {\n      console.error(`${v.name}: ${e}`);\n      throw e;\n    }\n    if (result.secret) {\n      console.log(`${v.name} = ********`);\n    } else {\n      console.log(`${v.name} = ${result.value}`);\n    }\n    return result;\n  };\n};\n\nfunction createNestLoggerApplier(logger: Logger): Applier {\n  return <T>(transform: VT<T>): VT<T> => {\n    return (v: V<string | undefined>) => {\n      let result: V<T>;\n      try {\n        result = transform(v);\n      } catch (e) {\n        logger.error(`${v.name}: ${e}`);\n        throw e;\n      }\n      if (result.secret) {\n        logger.log(`${v.name} = ********`);\n      } else {\n        logger.log(`${v.name} = ${result.value}`);\n      }\n      return result;\n    };\n  };\n}\n```\n\n## `bind`\n\nWhen you have a `Reader` and (optionally) an `Applier`, you can use `bind` to\ncreate an object ready to read variables. It will automatically pull from\nyour configured source and pass through your applier as it is used.\n\n```typescript\nimport { asDuration, bind, must, pipe } from \"eevee\";\n\nconst ev = bind(processEnvReader(process.env), consoleLoggerApplier(console));\n\nconst host: string = ev(\"SERVICE_HOST\", must);\nconst hostTimeoutMilliseconds: number = ev(\n  \"SERVICE_TIMEOUT\",\n  pipe(must, asDuration),\n);\n```\n","readmeFilename":"README.md"}