Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

io-ts-fuzzy

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

io-ts-fuzzy - npm Package Compare versions

Comparing version 0.1.1 to 0.1.2

lib/fallbackInput.d.ts

2

lib/fallback.js

@@ -37,3 +37,3 @@ "use strict";

var t = require("io-ts");
exports.fallback = function (type, factory) { return new t.Type("fuzzy.optional<" + type.name + ">", function (it) { return type.is(it); }, function (input, context) {
exports.fallback = function (type, factory) { return new t.Type("fuzzy.fallback<" + type.name + ">", function (it) { return type.is(it); }, function (input, context) {
if (input === null || input === undefined || input === 'null') {

@@ -40,0 +40,0 @@ return t.success(factory());

export * from './boolean';
export * from './fallback';
export * from './fallbackInput';
export * from './float';

@@ -4,0 +5,0 @@ export * from './integer';

@@ -15,2 +15,3 @@ "use strict";

__exportStar(require("./fallback"), exports);
__exportStar(require("./fallbackInput"), exports);
__exportStar(require("./float"), exports);

@@ -17,0 +18,0 @@ __exportStar(require("./integer"), exports);

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

"license": "MIT",
"version": "0.1.1",
"version": "0.1.2",
"description": "A collection of io-ts codecs for fuzzy decoding untyped configs and similar things",

@@ -8,0 +8,0 @@ "main": "lib/index.js",

@@ -6,3 +6,3 @@ import { isLeft, left } from 'fp-ts/lib/Either'

export const fallback = <T>(type: t.Type<T>, factory: (() => T)) => new t.Type<T>(
`fuzzy.optional<${type.name}>`,
`fuzzy.fallback<${type.name}>`,
(it): it is T => type.is(it),

@@ -9,0 +9,0 @@ (input, context) => {

export * from './boolean'
export * from './fallback'
export * from './fallbackInput'
export * from './float'

@@ -4,0 +5,0 @@ export * from './integer'

@@ -23,5 +23,5 @@ import { fallback } from '../src/fallback'

assertFailure(myType, 15.13, [
'Invalid value 15.13 supplied to : fuzzy.optional<fuzzy.integer>/: fuzzy.integer',
'Invalid value 15.13 supplied to : fuzzy.fallback<fuzzy.integer>/: fuzzy.integer',
])
})
})
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