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

io-ts-validator

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

io-ts-validator - npm Package Compare versions

Comparing version 0.0.1 to 0.0.2

32

lib/validator.d.ts

@@ -16,3 +16,2 @@ import * as t from 'io-ts';

};
export declare type Assert<A> = <I extends A>(i: I) => I;
export declare type DecodeSync<_E, I, A> = (i: I) => A;

@@ -26,3 +25,7 @@ export declare type EncodeSync<_E, A, O> = (i: A) => O;

export declare type EncodeEither<E, A, O> = (a: A) => Either<E, O>;
interface Extension<E, A, SO, SI> {
export declare type Check<A> = (u: unknown) => u is A;
export declare type Assert<A> = <I extends A>(i: I) => I;
export declare type _Validator<E, A, O, SO, I, SI> = {
readonly _codec: Codec<A, O, I>;
readonly _settings: Settings<E, O, SO, I, SI>;
readonly decodeSync: DecodeSync<E, SI, A>;

@@ -36,22 +39,9 @@ readonly encodeSync: EncodeSync<E, A, SO>;

readonly encodeEither: EncodeEither<E, A, SO>;
readonly check: Check<A>;
readonly assert: Assert<A>;
}
export declare class Validator<E, A, O = A, SO = O, I = unknown, SI = I> implements Codec<A, O, I>, Extension<E, A, SO, SI> {
readonly _E: E;
readonly _A: A;
readonly _O: O;
readonly _SO: SO;
readonly _I: I;
readonly _SI: SI;
};
export declare class Validator<E, A, O = A, SO = O, I = unknown, SI = I> implements _Validator<E, A, O, SO, I, SI> {
readonly _codec: Codec<A, O, I>;
readonly _settings: Settings<E, O, SO, I, SI>;
readonly _codec: Codec<A, O, I>;
constructor(codec: Codec<A, O, I>, settings: Settings<E, O, SO, I, SI>);
readonly name: string;
readonly is: t.Is<A>;
readonly validate: t.Validate<I, A>;
readonly encode: t.Encode<A, O>;
readonly pipe: <B, IB, A_1 extends IB, OB extends A_1>(this: t.Type<A_1, O, I>, ab: t.Type<B, OB, IB>, name?: string | undefined) => t.Type<B, O, I>;
readonly asEncoder: () => t.Encoder<A, O>;
readonly asDecoder: () => t.Decoder<I, A>;
readonly decode: (i: I) => Either<t.Errors, A>;
encodeEither(a: A): Either<E, SO>;

@@ -65,2 +55,3 @@ encodeSync(a: A): SO;

decodePromise(si: SI): Promise<A>;
check(u: unknown): u is A;
assert<X extends A>(x: X): X;

@@ -80,5 +71,4 @@ }

export declare type CustomOrDefault<E, O, SO, I, SI> = Defaults<O, I> | Settings<E, O, SO, I, SI>;
export declare function validator<E, A, O, SO, I, SI>(codec: Codec<A, O, I>, options: undefined): Validator<Array<string>, A, O, O, I, I>;
export declare function validator<E, A, O, SO, I, SI>(codec: Codec<A, O, I>): Validator<Array<string>, A, O, O, I, I>;
export declare function validator<E, A, O, SO, I, SI>(codec: Codec<A, O, I>, options: 'json'): Validator<Array<string>, A, O, string, I, string>;
export declare function validator<E, A, O, SO, I, SI>(codec: Codec<A, O, I>, options: FromDefaults<E, O, SO, I, SI>): Validator<E, A, O, SO, I, SI>;
export {};

@@ -24,12 +24,5 @@ "use strict";

var pipeable_1 = require("fp-ts/lib/pipeable");
/* eslint-disable */
var Validator = /** @class */ (function () {
function Validator(codec, settings) {
this.name = this._codec.name;
this.is = this._codec.is;
this.validate = this._codec.validate;
this.encode = this._codec.encode;
this.pipe = this._codec.pipe;
this.asEncoder = this._codec.asEncoder;
this.asDecoder = this._codec.asDecoder;
this.decode = this._codec.decode;
this._codec = codec;

@@ -40,3 +33,3 @@ this._settings = settings;

var _this = this;
return pipeable_1.pipe(this.encode(a), function (o) { return Either_.tryCatch(function () { return _this._settings.parser.serialize(o); }, function () { return _this._settings.mapError([]); }); });
return pipeable_1.pipe(this._codec.encode(a), function (o) { return Either_.tryCatch(function () { return _this._settings.parser.serialize(o); }, function () { return _this._settings.mapError([]); }); });
};

@@ -54,3 +47,3 @@ Validator.prototype.encodeSync = function (a) {

Validator.prototype.decodeEither = function (si) {
return pipeable_1.pipe(this._settings.parser.deserialize(si), this.decode, Either_.mapLeft(this._settings.mapError));
return pipeable_1.pipe(this._settings.parser.deserialize(si), this._codec.decode, Either_.mapLeft(this._settings.mapError));
};

@@ -67,2 +60,5 @@ Validator.prototype.decodeSync = function (si) {

};
Validator.prototype.check = function (u) {
return this._codec.is(u);
};
Validator.prototype.assert = function (x) {

@@ -69,0 +65,0 @@ return x;

{
"name": "io-ts-validator",
"version": "0.0.1",
"version": "0.0.2",
"description": "",

@@ -5,0 +5,0 @@ "main": "lib/validator.js",

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