@appliedblockchain/assert-combinators
Advanced tools
Comparing version 0.0.3 to 1.0.0
@@ -1,6 +0,6 @@ | ||
// @flow | ||
// @flow strict | ||
/*:: | ||
type $A<R> = any => R | ||
type $A<R> = mixed => R | ||
@@ -7,0 +7,0 @@ declare function and<A>($A<A>): $A<A>; |
10
array.js
@@ -1,7 +0,7 @@ | ||
// @flow | ||
// @flow strict | ||
const any = require('./any') | ||
const mixed = require('./mixed') | ||
const array /*: <T>(a?: any => T) => (any => T[]) */ = /*:: <T> */ | ||
(a = any) => | ||
const array /*: <T>(a?: mixed => T) => (mixed => $ReadOnlyArray<T>) */ = /*:: <T> */ | ||
(a = mixed) => | ||
value => { | ||
@@ -11,3 +11,3 @@ if (!Array.isArray(value)) { | ||
} | ||
if (a && a !== any) { | ||
if (a && a !== mixed) { | ||
value.every(_ => a(_)) | ||
@@ -14,0 +14,0 @@ } |
@@ -1,6 +0,6 @@ | ||
// @flow | ||
// @flow strict | ||
const { inspect } = require('util') | ||
const boolean /*: any => boolean */ = | ||
const boolean /*: mixed => boolean */ = | ||
value => { | ||
@@ -7,0 +7,0 @@ if (typeof value !== 'boolean') { |
# Changelog | ||
## [v1.0.0](../../compare/v0.0.3...v1.0.0) (2020-03-31) | ||
* Multiple updates. | ||
* Adding gt, gte, lt and lte. | ||
* Adding defined. | ||
* Updating changelog. | ||
## [v0.0.3](../../compare/v0.0.2...v0.0.3) (2020-03-12) | ||
@@ -4,0 +11,0 @@ |
@@ -1,2 +0,2 @@ | ||
// @flow | ||
// @flow strict | ||
@@ -7,3 +7,3 @@ const { inspect } = require('util') | ||
const dateString /*: any => string */ = | ||
const dateString /*: mixed => string */ = | ||
value => { | ||
@@ -10,0 +10,0 @@ if (typeof value !== 'string') { |
14
index.js
// @flow | ||
const and = require('./and') | ||
const any = require('./any') | ||
const array = require('./array') | ||
const boolean = require('./boolean') | ||
const dateString = require('./date-string') | ||
const defined = require('./defined') | ||
const exact = require('./exact') | ||
const finite = require('./finite') | ||
const mixed = require('./mixed') | ||
const nilOr = require('./nil-or') | ||
const nullOr = require('./null-or') | ||
const number = require('./number') | ||
@@ -17,11 +20,15 @@ const object = require('./object') | ||
const tuple = require('./tuple') | ||
const undefinedOr = require('./undefined-or') | ||
module.exports = { | ||
and, | ||
any, | ||
array, | ||
boolean, | ||
dateString, | ||
defined, | ||
exact, | ||
finite, | ||
mixed, | ||
nilOr, | ||
nullOr, | ||
number, | ||
@@ -33,3 +40,4 @@ object, | ||
taggedOr, | ||
tuple | ||
tuple, | ||
undefinedOr | ||
} |
@@ -1,6 +0,6 @@ | ||
// @flow | ||
// @flow strict | ||
const { inspect } = require('util') | ||
const number /*: any => number */ = | ||
const number /*: mixed => number */ = | ||
value => { | ||
@@ -7,0 +7,0 @@ if (typeof value !== 'number') { |
@@ -1,6 +0,6 @@ | ||
// @flow | ||
// @flow strict | ||
const { inspect } = require('util') | ||
const object /*: <KV: {}>(KV) => any => $ObjMapi<KV, <K, V>(K, (...Iterable<any>) => V) => V> */ = /*:: <KV> */ | ||
const object /*: <KV: { ... }>(KV) => mixed => $ObjMapi<KV, <K, V>(K, (...Iterable<mixed>) => V) => V> */ = /*:: <KV> */ | ||
(kvs) => | ||
@@ -7,0 +7,0 @@ value => { |
{ | ||
"name": "@appliedblockchain/assert-combinators", | ||
"version": "0.0.3", | ||
"version": "1.0.0", | ||
"description": "Assertion combinators.", | ||
@@ -18,4 +18,4 @@ "main": "index.js", | ||
"eslint-plugin-jest": "23.8.2", | ||
"flow-bin": "0.120.1", | ||
"jest": "25.1.0" | ||
"flow-bin": "0.121.0", | ||
"jest": "25.2.4" | ||
}, | ||
@@ -22,0 +22,0 @@ "eslintConfig": { |
@@ -1,6 +0,6 @@ | ||
// @flow | ||
// @flow string | ||
const { inspect } = require('util') | ||
const string /*: any => string */ = | ||
const string /*: mixed => string */ = | ||
value => { | ||
@@ -7,0 +7,0 @@ if (typeof value !== 'string') { |
@@ -46,4 +46,5 @@ // @flow | ||
} | ||
if (value.length !== as.length) { | ||
throw new TypeError(`Expected tuple arity ${as.length}, got ${value.length} in ${inspect(value)}.`) | ||
// TODO: Check min/max arity, trim undefined tail. | ||
if (value.length > as.length) { | ||
throw new TypeError(`Expected tuple arity less or equal to ${as.length}, got ${value.length} in ${inspect(value)}.`) | ||
} | ||
@@ -50,0 +51,0 @@ return value.map((_, i) => as[i](_)) |
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
38876
29
477
1
0