@fp-ts/schema
Advanced tools
Comparing version 0.1.0 to 0.1.1
{ | ||
"name": "@fp-ts/schema", | ||
"version": "0.1.0", | ||
"version": "0.1.1", | ||
"license": "MIT", | ||
@@ -5,0 +5,0 @@ "repository": { |
@@ -377,3 +377,10 @@ "use strict"; | ||
const type = go(ast.from); | ||
return make(I.makeSchema(ast), (u, options) => (0, _Function.pipe)(type.parse(u, options), I.flatMap(a => ast.refinement(a) ? PR.success(a) : PR.failure(PR.type(ast, a))))); | ||
const checkRefinement = a => ast.refinement(a) ? PR.success(a) : PR.failure(PR.type(ast, a)); | ||
switch (as) { | ||
case "guard": | ||
case "decoder": | ||
return make(I.makeSchema(ast), (u, options) => (0, _Function.pipe)(type.parse(u, options), I.flatMap(checkRefinement))); | ||
case "encoder": | ||
return make(I.makeSchema(ast), (u, options) => (0, _Function.pipe)(checkRefinement(u), I.flatMap(a => type.parse(a, options)))); | ||
} | ||
} | ||
@@ -380,0 +387,0 @@ case "Transform": |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
527585
7768