@lanetix/type-visitor
Advanced tools
Comparing version 4.1.0 to 4.1.1
@@ -17,3 +17,4 @@ /* eslint-disable no-new-wrappers */ | ||
sum: 'sum', | ||
product: 'product' | ||
product: 'product', | ||
price: 'price' | ||
}; | ||
@@ -74,2 +75,5 @@ | ||
return varop(down, acc, { fun: tyfun.product, args: args, ctx: ctx }); | ||
}, | ||
price: function price(acc, ctx) { | ||
return prim(acc, { fun: tyfun.price, ctx: ctx }); | ||
} | ||
@@ -91,2 +95,3 @@ }; | ||
var product = _ref6.product; | ||
var price = _ref6.price; | ||
@@ -203,2 +208,4 @@ var visitInner = function visitInner(acc, _ref7) { | ||
return check_varop({ tag: visitContext.productChild, check: product }); | ||
case tyfun.price: | ||
return check_primitive(price); | ||
default: | ||
@@ -277,2 +284,5 @@ throw new Error('invalid type function'); | ||
}); | ||
}, | ||
price: function price(exp) { | ||
return typeof exp === 'number' && Number.isFinite(exp); | ||
} | ||
@@ -307,2 +317,4 @@ }); | ||
return builtin('product'); | ||
case tyfun.price: | ||
return builtin('price'); | ||
default: | ||
@@ -342,2 +354,4 @@ // should be unreachable since this is only called internally from visit. | ||
return tyfun.product; | ||
case 'price': | ||
return tyfun.price; | ||
default: | ||
@@ -344,0 +358,0 @@ throw new Error('invalid type function name'); |
{ | ||
"name": "@lanetix/type-visitor", | ||
"version": "4.1.0", | ||
"version": "4.1.1", | ||
"description": "visit your types", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -36,2 +36,6 @@ @lanetix/type-visitor | ||
#### `tyfun.string` | ||
#### `tyfun.price` | ||
### Uniary Types | ||
@@ -231,7 +235,7 @@ | ||
structure should be considered an opaque implementation detail--it should not | ||
be used directly, except in order to pass it into intoTy. | ||
be used directly, except in order to pass it into toTy. | ||
### `intoTy` | ||
### `toTy` | ||
Takes a JSON structure created by toJson and parses it into a type tree. It | ||
should only be used on JSON that was previously formed through toJson; | ||
constructing the JSON directly isn't guaranteed to work. |
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
21600
390
240
0
3