🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more →

valienv

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

valienv - npm Package Compare versions

Comparing version

to
1.0.0

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

class e extends Error{constructor(t){super("Some environment variables cannot be validated: "+t.join(", ")),this.variables=void 0,Object.setPrototypeOf(this,e.prototype),this.name=this.constructor.name,this.variables=t}}const t=/^[^@\s]+@[^@\s]+\.[^@\s]+$/;exports.EnvValidationError=e,exports.boolean=function(e){return void 0===e&&(e=""),"true"===e||"1"===e||"false"!==e&&"0"!==e&&void 0},exports.email=function(e){if(void 0===e&&(e=""),t.test(e))return e},exports.number=function(e){void 0===e&&(e="");const t=Number.parseFloat(e);if(!Number.isNaN(t))return t},exports.oneOf=function(){var e=arguments;return function(t){void 0===t&&(t="");const o=[].slice.call(e).find(e=>e===t);if(void 0!==o)return o}},exports.optional=e=>t=>{const o=e(t);return void 0!==o?{defined:!0,value:o}:{defined:!1}},exports.port=function(e){void 0===e&&(e="");const t=Number.parseFloat(e);if(!Number.isNaN(t)&&t%1==0&&t>0&&t<65536)return t},exports.string=function(e){if(void 0===e&&(e=""),""!==e)return e},exports.url=function(e){void 0===e&&(e="");try{return new URL(e),e}catch{}},exports.validate=t=>{let{env:o,validators:r,overrides:n={}}=t;const i={},s=[],a=Object.keys(r),c=Object.keys(n).filter(e=>-1!==a.indexOf(e));if(c.forEach(e=>{i[e]=n[e]}),a.forEach(e=>{if(-1!==c.indexOf(e))return;const t=r[e];if(void 0!==t){const r=t(o[e]);void 0!==r?i[e]=r:s.push(e)}}),s.length>0){const t=new e(s);if("undefined"==typeof process)throw t;console.error(t.message),process.exit(1)}return i};
class e extends Error{constructor(t){super("Some environment variables cannot be validated: "+t.join(", ")),this.variables=void 0,Object.setPrototypeOf(this,e.prototype),this.name=this.constructor.name,this.variables=t}}const t=/^[^@\s]+@[^@\s]+\.[^@\s]+$/;exports.EnvValidationError=e,exports.boolean=function(e){return void 0===e&&(e=""),"true"===e||"1"===e||"false"!==e&&"0"!==e&&void 0},exports.email=function(e){if(void 0===e&&(e=""),t.test(e))return e},exports.number=function(e){void 0===e&&(e="");const t=Number.parseFloat(e);if(!Number.isNaN(t))return t},exports.oneOf=function(){var e=arguments;return function(t){void 0===t&&(t="");const o=[].slice.call(e).find(e=>e===t);if(void 0!==o)return o}},exports.optional=e=>t=>{const o=e(t);return void 0!==o?{defined:!0,value:o}:{defined:!1}},exports.port=function(e){void 0===e&&(e="");const t=Number.parseFloat(e);if(!Number.isNaN(t)&&t%1==0&&t>0&&t<65536)return t},exports.string=function(e){if(void 0===e&&(e=""),""!==e)return e},exports.url=function(e){void 0===e&&(e="");try{return new URL(e),e}catch(e){}},exports.validate=t=>{let{env:o,validators:r,overrides:n={}}=t;const i={},s=[],a=Object.keys(r),c=Object.keys(n).filter(e=>-1!==a.indexOf(e));if(c.forEach(e=>{i[e]=n[e]}),a.forEach(e=>{if(-1!==c.indexOf(e))return;const t=r[e];if(void 0!==t){const r=t(o[e]);void 0!==r?i[e]=r:s.push(e)}}),s.length>0){const t=new e(s);if("undefined"==typeof process)throw t;console.error(t.message),process.exit(1)}return i};
//# sourceMappingURL=index.js.map

@@ -5,3 +5,3 @@ import { Validator } from "./validators";

validators: Validators;
overrides?: { [Key in keyof Validators]?: ReturnType<Validators[Key]> | undefined; } | undefined;
}) => Readonly<{ [Key_1 in keyof Validators]: Exclude<ReturnType<Validators[Key_1]>, undefined>; }>;
overrides?: { [Key in keyof Validators]?: ReturnType<Validators[Key]>; };
}) => Readonly<{ [Key in keyof Validators]: Exclude<ReturnType<Validators[Key]>, undefined>; }>;
{
"name": "valienv",
"version": "0.7.0",
"version": "1.0.0",
"license": "MIT",

@@ -32,3 +32,3 @@ "description": "A simple environment variables validator for Node.js, web browsers and React Native",

"format": "prettier '**/*' -u -w",
"lint": "eslint --ext ts,tsx __tests__ src",
"lint": "eslint",
"test": "vitest --run",

@@ -50,12 +50,13 @@ "test:watch": "vitest --watch",

"devDependencies": {
"@types/node": "^20.12.12",
"@typescript-eslint/eslint-plugin": "^7.10.0",
"@typescript-eslint/parser": "^7.10.0",
"eslint": "^8.57.0",
"@eslint/js": "^9.19.0",
"@types/node": "^20.17.17",
"eslint": "^9.19.0",
"globals": "^15.14.0",
"microbundle": "^0.15.1",
"prettier": "^3.2.5",
"prettier-plugin-organize-imports": "^3.2.4",
"typescript": "^5.4.5",
"vitest": "^1.6.0"
"prettier": "^3.4.2",
"prettier-plugin-organize-imports": "^4.1.0",
"typescript": "^5.7.3",
"typescript-eslint": "^8.23.0",
"vitest": "^3.0.5"
}
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet