New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

myzod

Package Overview
Dependencies
Maintainers
1
Versions
92
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

myzod - npm Package Compare versions

Comparing version 1.0.0-alpha.1 to 1.0.0-alpha.2

5

libs/types.d.ts

@@ -8,6 +8,3 @@ export declare abstract class Type<T> {

nullable(): NullableType<this>;
try(value: unknown): {
error: ValidationError | null;
value: T | null;
};
try(value: unknown): T | ValidationError;
}

@@ -14,0 +11,0 @@ export declare class ValidationError extends Error {

@@ -16,7 +16,6 @@ "use strict";

try {
const result = this.parse(value);
return { value: result, error: null };
return this.parse(value);
}
catch (err) {
return { error: err, value: null };
return err;
}

@@ -23,0 +22,0 @@ }

2

package.json
{
"name": "myzod",
"version": "1.0.0-alpha.1",
"version": "1.0.0-alpha.2",
"description": "",

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

@@ -116,8 +116,12 @@ # myzod

Takes an unknown value and returns a result object with value/error properties. This api if you do not want to throw exceptions.
Takes an unknown value and returns a result which will either be the parsed value or an instance of ValidationError.
This api is useful if you do not want to throw exceptions.
```typescript
// Error will be a ValidationError on failure and null on success.
// Value will be the parsed value on success and null on failure
const { value, error } = schema.try(data);
const result = schema.try(data);
if (result instanceof myzod.ValidationError) {
// handle Error
} else {
// result is of type: myzod.Infer<typeof schema>
}
```

@@ -124,0 +128,0 @@

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