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
2
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 1.2.0 to 1.2.1

2

package.json
{
"name": "io-ts-reporters",
"version": "1.2.0",
"version": "1.2.1",
"description": "Formatting of io-ts validation errors",

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

@@ -52,2 +52,10 @@ /**

/**
* @category internals
* @since 1.2.1
*/
export const TYPE_MAX_LEN = 160; // Two lines of 80-col text
const truncateType = (type: string): string =>
type.length > TYPE_MAX_LEN ? `${type.slice(0, TYPE_MAX_LEN - 3)}...` : type;
const errorMessageSimple = (

@@ -60,3 +68,3 @@ expectedType: string,

[
`Expecting ${expectedType}`,
`Expecting ${truncateType(expectedType)}`,
path === '' ? '' : `at ${path}`,

@@ -77,3 +85,3 @@ `but instead got: ${jsToString(error.value)}`,

'Expecting one of:\n',
expectedTypes.map(type => ` ${type}`).join('\n'),
expectedTypes.map(type => ` ${truncateType(type)}`).join('\n'),
path === '' ? '\n' : `\nat ${path} `,

@@ -80,0 +88,0 @@ `but instead got: ${jsToString(value)}`

@@ -6,2 +6,7 @@ import * as E from 'fp-ts/lib/Either';

/**
* @category internals
* @since 1.2.1
*/
export declare const TYPE_MAX_LEN = 160;
/**
* Format a single validation error.

@@ -8,0 +13,0 @@ *

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.reporter = exports.formatValidationErrors = exports.formatValidationError = void 0;
exports.reporter = exports.formatValidationErrors = exports.formatValidationError = exports.TYPE_MAX_LEN = void 0;
/**

@@ -54,6 +54,14 @@ * An [io-ts Reporter](https://gcanti.github.io/io-ts/modules/Reporter.ts.html#reporter-interface).

};
/**
* @category internals
* @since 1.2.1
*/
exports.TYPE_MAX_LEN = 160; // Two lines of 80-col text
var truncateType = function (type) {
return type.length > exports.TYPE_MAX_LEN ? type.slice(0, exports.TYPE_MAX_LEN - 3) + "..." : type;
};
var errorMessageSimple = function (expectedType, path, error) {
// https://github.com/elm-lang/core/blob/18c9e84e975ed22649888bfad15d1efdb0128ab2/src/Native/Json.js#L199
return [
"Expecting " + expectedType,
"Expecting " + truncateType(expectedType),
path === '' ? '' : "at " + path,

@@ -70,3 +78,3 @@ "but instead got: " + jsToString(error.value),

'Expecting one of:\n',
expectedTypes.map(function (type) { return " " + type; }).join('\n'),
expectedTypes.map(function (type) { return " " + truncateType(type); }).join('\n'),
path === '' ? '\n' : "\nat " + path + " ",

@@ -73,0 +81,0 @@ "but instead got: " + jsToString(value)

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