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

@arundo/typed-env

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@arundo/typed-env - npm Package Compare versions

Comparing version 0.0.1 to 0.0.2

6

CHANGELOG.md
# @arunod/typed-env
## 0.0.2
### Patch Changes
- support camelcase naming convention
## 0.0.1

@@ -4,0 +10,0 @@

9

dist/index.d.ts
import { z } from 'zod';
declare const typeEnvironment: <TSchema extends Record<string, unknown>>(schema: z.ZodType<TSchema, z.ZodTypeDef, TSchema>, transformKeyFn?: (key: string) => string, formatErrorFn?: (error: z.ZodError) => string) => TSchema;
type SnakeToCamelCase<S extends string> = S extends `${infer T}_${infer U}` ? `${Lowercase<T>}${Capitalize<SnakeToCamelCase<U>>}` : Lowercase<S>;
type OutputType<InputType> = {
[K in keyof InputType as SnakeToCamelCase<string & K>]: InputType[K];
};
type NamingConvention = 'camelcase' | 'default';
type BaseSchema = Record<string, unknown>;
type EnvReturnType<T, S extends BaseSchema> = T extends 'camelcase' ? OutputType<S> : S;
declare const typeEnvironment: <TSchema extends BaseSchema, TTransform extends NamingConvention = "default">(schema: z.ZodType<TSchema, z.ZodTypeDef, TSchema>, transform?: TTransform, formatErrorFn?: (error: z.ZodError) => string) => EnvReturnType<TTransform, TSchema>;
export { typeEnvironment };

4

dist/index.js

@@ -1,2 +0,2 @@

"use strict";var a=Object.defineProperty;var i=Object.getOwnPropertyDescriptor;var m=Object.getOwnPropertyNames;var c=Object.prototype.hasOwnProperty;var d=(n,r)=>{for(var o in r)a(n,o,{get:r[o],enumerable:!0})},h=(n,r,o,e)=>{if(r&&typeof r=="object"||typeof r=="function")for(let t of m(r))!c.call(n,t)&&t!==o&&a(n,t,{get:()=>r[t],enumerable:!(e=i(r,t))||e.enumerable});return n};var E=n=>h(a({},"__esModule",{value:!0}),n);var v={};d(v,{typeEnvironment:()=>p});module.exports=E(v);var s=require("zod"),f=n=>r=>Object.fromEntries(Object.entries(r).map(([o,e])=>[n(o),e])),g=n=>`Environment variable validation failed:${n.issues.map(r=>`
'${r.path.join(",")}': ${r.message}`).join(",")}`,p=(n,r=e=>e,o=g)=>{try{return n.transform(f(r)).parse(process.env)}catch(e){throw e instanceof s.z.ZodError?new Error(o(e)):new Error("Environment variable validation failed")}};0&&(module.exports={typeEnvironment});
"use strict";var o=Object.defineProperty;var m=Object.getOwnPropertyDescriptor;var c=Object.getOwnPropertyNames;var i=Object.prototype.hasOwnProperty;var T=(a,e)=>{for(var r in e)o(a,r,{get:e[r],enumerable:!0})},p=(a,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let t of c(e))!i.call(a,t)&&t!==r&&o(a,t,{get:()=>e[t],enumerable:!(n=m(e,t))||n.enumerable});return a};var S=a=>p(o({},"__esModule",{value:!0}),a);var l={};T(l,{typeEnvironment:()=>d});module.exports=S(l);var s=require("zod"),f=a=>a.toLowerCase().replace(/_([a-z])/g,(e,r)=>r.toUpperCase()),h=a=>e=>Object.fromEntries(Object.entries(e).map(([r,n])=>[a(r),n])),y=a=>`Environment variable validation failed:${a.issues.map(e=>`
'${e.path.join(",")}': ${e.message}`).join(",")}`,d=(a,e="default",r=y)=>{try{return a.transform(n=>e==="camelcase"?h(f)(n):n).parse(process.env)}catch(n){throw n instanceof s.z.ZodError?new Error(r(n)):new Error("Environment variable validation failed")}};0&&(module.exports={typeEnvironment});
{
"name": "@arundo/typed-env",
"version": "0.0.1",
"version": "0.0.2",
"description": "Typed environment variables made easy 🚀",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

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