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

io-ts-reporters

Package Overview
Dependencies
Maintainers
1
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

io-ts-reporters - npm Package Compare versions

Comparing version 0.0.21 to 1.0.0

8

package.json

@@ -5,3 +5,3 @@ {

"typings": "./target/src/index.d.ts",
"version": "0.0.21",
"version": "1.0.0",
"scripts": {

@@ -17,9 +17,9 @@ "lint": "tslint --project tsconfig.json",

"dependencies": {
"fp-ts": "^1.0.1",
"io-ts": "^1.0.2"
"fp-ts": "^2.0.2",
"io-ts": "^2.0.0"
},
"devDependencies": {
"tslint": "^5.8.0",
"typescript": "^2.7.2"
"typescript": "^3.5.3"
}
}

@@ -9,5 +9,12 @@ # io-ts-reporters

## TypeScript compatibility
| io-ts-reporters version | required typescript version |
| ----------------------- | --------------------------- |
| 1.0.0 | 3.5+ |
| <= 0.0.21 | 2.7+ |
## Installation
``` bash
```bash
yarn add io-ts-reporters

@@ -22,3 +29,3 @@ ```

``` bash
```bash
yarn

@@ -28,2 +35,2 @@ yarn run test

[io-ts]: https://github.com/gcanti/io-ts#error-reporters
[io-ts]: https://github.com/gcanti/io-ts#error-reporters
import * as t from 'io-ts';
import { Left, Right } from 'fp-ts/lib/Either';
import { None, Some } from 'fp-ts/lib/Option';
export declare const formatValidationError: (error: t.ValidationError) => None<string> | Some<string>;
export declare const reporter: <T>(validation: Left<t.ValidationError[], T> | Right<t.ValidationError[], T>) => string[];
export declare const formatValidationError: (error: t.ValidationError) => import("fp-ts/lib/Option").Option<string>;
export declare const reporter: <T>(validation: import("fp-ts/lib/Either").Either<t.Errors, T>) => string[];
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var array = require("fp-ts/lib/Array");
/* tslint:enable no-unused-variable */
var Either_1 = require("fp-ts/lib/Either");
var Option_1 = require("fp-ts/lib/Option");
var pipeable_1 = require("fp-ts/lib/pipeable");
var jsToString = function (value) { return (value === undefined ? 'undefined' : JSON.stringify(value)); };

@@ -9,2 +11,4 @@ exports.formatValidationError = function (error) {

.map(function (c) { return c.key; })
// The context entry with an empty key is the original type ("default
// context"), not an type error.
.filter(function (key) { return key.length > 0; })

@@ -16,3 +20,3 @@ .join('.');

error.context);
return maybeErrorContext.map(function (errorContext) {
return pipeable_1.pipe(maybeErrorContext, Option_1.map(function (errorContext) {
var expectedType = errorContext.type.name;

@@ -25,5 +29,5 @@ return (

+ (" but instead got: " + jsToString(error.value) + "."));
});
}));
};
exports.reporter = function (validation) { return (validation.fold(function (errors) { return array.catOptions(errors.map(exports.formatValidationError)); }, function () { return []; })); };
exports.reporter = function (validation) { return (pipeable_1.pipe(validation, Either_1.fold(function (errors) { return array.compact(errors.map(exports.formatValidationError)); }, function () { return []; }))); };
//# sourceMappingURL=index.js.map

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