@schroffl/json-mapping
Advanced tools
Comparing version
14
index.js
@@ -37,2 +37,14 @@ // The export pattern is a UMD template: | ||
/** | ||
* The 'ok' and 'error' wrappers only exist for performance reasons. | ||
* Previously I had an implementation that threw immediately when | ||
* a decoder failed, but that had a hefty impact on the performance | ||
* of Decode.oneOf, because it expects some of it's child decoders | ||
* to fail. | ||
* | ||
* Now we have a separate decodeInternal function which uses the | ||
* result wrappers and a user-exposed decode function which throws | ||
* if the decoder fails. | ||
*/ | ||
function ok(value) { | ||
@@ -118,3 +130,3 @@ return { ok: true, value: value }; | ||
} else { | ||
return result; | ||
return ok(result); | ||
} | ||
@@ -121,0 +133,0 @@ } |
{ | ||
"name": "@schroffl/json-mapping", | ||
"version": "0.0.1", | ||
"version": "0.0.2", | ||
"description": "A set of utilites for defining and running conversions between JSON and JavaScript values", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
9048
5.84%233
4.95%