Skip to content

Commit

Permalink
fix: upgrade kuvio, fix tests
Browse files Browse the repository at this point in the history
Kuvio had a breaking change to rename `then` to `andThen` to avoid
issues with certain bundlers.
  • Loading branch information
skeate committed Sep 19, 2024
1 parent 0937bd2 commit 2008064
Show file tree
Hide file tree
Showing 12 changed files with 90 additions and 86 deletions.
1 change: 1 addition & 0 deletions .node-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
18.20.4
30 changes: 15 additions & 15 deletions docs/schemata/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,23 +85,23 @@ has_children: true

### String (17)

* Ascii ([docs](https://jacob-alford.github.io/schemata-ts/schemata/Ascii.html)) ([source](https://github.com/jacob-alford/schemata-ts/tree/main/src/schemata/Ascii.ts)) (e.g: `H.*G sx`, `F+{y`, `0tE'?j}dQy`)
* Base64 ([docs](https://jacob-alford.github.io/schemata-ts/schemata/Base64.html)) ([source](https://github.com/jacob-alford/schemata-ts/tree/main/src/schemata/Base64.ts)) (e.g: `1I95+//7+51M++n5+h/C9/P++0i+PHw+`, `5+2/++k83a5//+++`, `7E/1+017HXGT`)
* Base64Url ([docs](https://jacob-alford.github.io/schemata-ts/schemata/Base64Url.html)) ([source](https://github.com/jacob-alford/schemata-ts/tree/main/src/schemata/Base64Url.ts)) (e.g: `7FLto--`, `3t_-A94`, `C--d3___`)
* BitcoinAddress ([docs](https://jacob-alford.github.io/schemata-ts/schemata/BitcoinAddress.html)) ([source](https://github.com/jacob-alford/schemata-ts/tree/main/src/schemata/BitcoinAddress.ts)) (e.g: `1d9LBJjPnRCLFpxMNmxYcCncAR11J`, `bc1132b3d00ce5ecb221x3azt78y6bd`, `1Gd8By3Sx8UemNY2hF7NFL4J9LwouCNkB3M`)
* Ascii ([docs](https://jacob-alford.github.io/schemata-ts/schemata/Ascii.html)) ([source](https://github.com/jacob-alford/schemata-ts/tree/main/src/schemata/Ascii.ts)) (e.g: `H~{n~`, `|"|Zc`, `G$j01\!`)
* Base64 ([docs](https://jacob-alford.github.io/schemata-ts/schemata/Base64.html)) ([source](https://github.com/jacob-alford/schemata-ts/tree/main/src/schemata/Base64.ts)) (e.g: `+/M/D9/tee/26+4b/Y6w`, `0b//+c/D`, `y/+WbOOf53rEO6W/`)
* Base64Url ([docs](https://jacob-alford.github.io/schemata-ts/schemata/Base64Url.html)) ([source](https://github.com/jacob-alford/schemata-ts/tree/main/src/schemata/Base64Url.ts)) (e.g: `-_0_34-8-2`, `1_-37q-`, `1-58uRf2y`)
* BitcoinAddress ([docs](https://jacob-alford.github.io/schemata-ts/schemata/BitcoinAddress.html)) ([source](https://github.com/jacob-alford/schemata-ts/tree/main/src/schemata/BitcoinAddress.ts)) (e.g: `bc1312ju4bkos5xai5f5lcao1866x2s`, `bc1uze27t4w8y289897t7chd9y0b1g29d6v11`, `11GCLd3X9dHKuJdL9nyTXL1EMJz4LA6PT4SuMN`)
* CamelCaseString ([docs](https://jacob-alford.github.io/schemata-ts/schemata/CamelCaseString.html)) ([source](https://github.com/jacob-alford/schemata-ts/tree/main/src/schemata/CamelCaseString.ts)) (e.g: `Camel_case-string``camelCaseString`)
* CreditCard ([docs](https://jacob-alford.github.io/schemata-ts/schemata/CreditCard.html)) ([source](https://github.com/jacob-alford/schemata-ts/tree/main/src/schemata/CreditCard.ts)) (e.g: `50801313963963700`, `6283198967192904`, `3028258966393379`)
* EmailAddress ([docs](https://jacob-alford.github.io/schemata-ts/schemata/EmailAddress.html)) ([source](https://github.com/jacob-alford/schemata-ts/tree/main/src/schemata/EmailAddress.ts)) (e.g: `_-&~V/-@9Uq6ED1.7---t-j.6p4O.i--.t2415i.-o-3n8-lK.-.-T9I71B-.39C3o5F96.-H51HRZRT-.9l-O-1cS-2.lchEPqZ`, `"燵䐜侑趢╿⒡"@[7.2.97.9]`, `--_-'@.ub3LH.0-.-hMD-Fw-i-.9..i-..1Y-337v.0L-0--W.CAyzcracDE`)
* EthereumAddress ([docs](https://jacob-alford.github.io/schemata-ts/schemata/EthereumAddress.html)) ([source](https://github.com/jacob-alford/schemata-ts/tree/main/src/schemata/EthereumAddress.ts)) (e.g: `0x3A628BFA1aFd2B8dcBBEb99BB436a6eB1BbefBcf`, `0xcBAbaDbAeD4bcDC13EccAba59F1FDdeFBDaa92EE`, `0xF105EcacFaeB0A70969baD9dEbCCb56DEEabBdce`)
* HexColor ([docs](https://jacob-alford.github.io/schemata-ts/schemata/HexColor.html)) ([source](https://github.com/jacob-alford/schemata-ts/tree/main/src/schemata/HexColor.ts)) (e.g: `#DbcFDfCC`, `1eaDfA`, `#fBb53C`)
* Hexadecimal ([docs](https://jacob-alford.github.io/schemata-ts/schemata/Hexadecimal.html)) ([source](https://github.com/jacob-alford/schemata-ts/tree/main/src/schemata/Hexadecimal.ts)) (e.g: `CE4eB0E`, `0HfCFcba`, `0H887dbf`)
* HslColor ([docs](https://jacob-alford.github.io/schemata-ts/schemata/HslColor.html)) ([source](https://github.com/jacob-alford/schemata-ts/tree/main/src/schemata/HslColor.ts)) (e.g: `hsl(.26881612562e42,000000000.978032341e423434320%,+0000000000.098184945347%,20e32894)`, `hsla(.9152574174+00062.2e235%+00.7%)`, `hsla(-.88908turn00000000.8319%000100%/7238096.8e78)`)
* Jwt ([docs](https://jacob-alford.github.io/schemata-ts/schemata/Jwt.html)) ([source](https://github.com/jacob-alford/schemata-ts/tree/main/src/schemata/Jwt.ts)) (e.g: `-829z.`, `m-f-Q_I.`, `.-_c2_.`)
* LatLong ([docs](https://jacob-alford.github.io/schemata-ts/schemata/LatLong.html)) ([source](https://github.com/jacob-alford/schemata-ts/tree/main/src/schemata/LatLong.ts)) (e.g: `(-82,106.44052800176)`, `(-90.000000,180)`, `82.823803,+180.0`)
* NonEmptyString ([docs](https://jacob-alford.github.io/schemata-ts/schemata/NonEmptyString.html)) ([source](https://github.com/jacob-alford/schemata-ts/tree/main/src/schemata/NonEmptyString.ts)) (e.g: `aa10e2be`, `931155df0be`, `!EVr`)
* RGB ([docs](https://jacob-alford.github.io/schemata-ts/schemata/RGB.html)) ([source](https://github.com/jacob-alford/schemata-ts/tree/main/src/schemata/RGB.ts)) (e.g: `rgb(37%,100%,92%)`, `rgba(96%,95%,98%,0.5789994179)`, `rgba(3%,100%,100%,.7)`)
* CreditCard ([docs](https://jacob-alford.github.io/schemata-ts/schemata/CreditCard.html)) ([source](https://github.com/jacob-alford/schemata-ts/tree/main/src/schemata/CreditCard.ts)) (e.g: `6282232524970410`, `8203326880704397`, `35299092605348294`)
* EmailAddress ([docs](https://jacob-alford.github.io/schemata-ts/schemata/EmailAddress.html)) ([source](https://github.com/jacob-alford/schemata-ts/tree/main/src/schemata/EmailAddress.ts)) (e.g: `+=B9|.#.}@[945.2.306.4]`, `/-3#_!=B?+-.}?.{*^.!/t~2^.&&_{.{^2&[email protected]`, `"뜐"@[753.879.47.77]`)
* EthereumAddress ([docs](https://jacob-alford.github.io/schemata-ts/schemata/EthereumAddress.html)) ([source](https://github.com/jacob-alford/schemata-ts/tree/main/src/schemata/EthereumAddress.ts)) (e.g: `0xab5afEfb1d7b8c1A738C0bC38b2aE2dDAd233fB8`, `0xe3c87FaFEC00f10dCEB31eca7BA2C08F3ac1f2Ab`, `0xc5cab6ddEaBe8Ea0BA1bfd2Ea707BF1B0f2c1CaE`)
* HexColor ([docs](https://jacob-alford.github.io/schemata-ts/schemata/HexColor.html)) ([source](https://github.com/jacob-alford/schemata-ts/tree/main/src/schemata/HexColor.ts)) (e.g: `#fB81AdDD`, `feBABD7A`, `7A2e8bCD`)
* Hexadecimal ([docs](https://jacob-alford.github.io/schemata-ts/schemata/Hexadecimal.html)) ([source](https://github.com/jacob-alford/schemata-ts/tree/main/src/schemata/Hexadecimal.ts)) (e.g: `9fAFDdd613`, `36aF0aED`, `0hbaD68`)
* HslColor ([docs](https://jacob-alford.github.io/schemata-ts/schemata/HslColor.html)) ([source](https://github.com/jacob-alford/schemata-ts/tree/main/src/schemata/HslColor.ts)) (e.g: `hsl(895476168.73e704,00000007%,100%,66.259289050465%)`, `hsl(+.121912860000000021%.8%/6%)`, `hsl(+.30222575704turn,00000091.65718e4977826%,+0000000100e600021442374%,6.896446e96182244%)`)
* Jwt ([docs](https://jacob-alford.github.io/schemata-ts/schemata/Jwt.html)) ([source](https://github.com/jacob-alford/schemata-ts/tree/main/src/schemata/Jwt.ts)) (e.g: `09--_-.-_W3-`, `Y-d1qV8-7x.6--Z-.`, `_3-._--_ea_D-`)
* LatLong ([docs](https://jacob-alford.github.io/schemata-ts/schemata/LatLong.html)) ([source](https://github.com/jacob-alford/schemata-ts/tree/main/src/schemata/LatLong.ts)) (e.g: `(83,-98)`, `(90,-1)`, `(90,107.802324)`)
* NonEmptyString ([docs](https://jacob-alford.github.io/schemata-ts/schemata/NonEmptyString.html)) ([source](https://github.com/jacob-alford/schemata-ts/tree/main/src/schemata/NonEmptyString.ts)) (e.g: `sfT1PUNOM/==`, `hjgxej8=`, `24aec9`)
* RGB ([docs](https://jacob-alford.github.io/schemata-ts/schemata/RGB.html)) ([source](https://github.com/jacob-alford/schemata-ts/tree/main/src/schemata/RGB.ts)) (e.g: `rgba(86%,97%,28%,.919263)`, `rgb(63%,100%,100%)`, `rgba(100%,23%,77%,1.0)`)
* String ([docs](https://jacob-alford.github.io/schemata-ts/schemata/String.html)) ([source](https://github.com/jacob-alford/schemata-ts/tree/main/src/schemata/String.ts))
* UUID ([docs](https://jacob-alford.github.io/schemata-ts/schemata/UUID.html)) ([source](https://github.com/jacob-alford/schemata-ts/tree/main/src/schemata/UUID.ts)) (e.g: `ab3FDCc1-aBfd-8D66-2396-bf6Babaa2182`, `CADfa2ad-0Bd1-7cDc-8f2C-b9EAdc3E6ceA`, `9FBBCAfC-3Ae1-D87e-ba8d-aa13D73C25d2`)
* UUID ([docs](https://jacob-alford.github.io/schemata-ts/schemata/UUID.html)) ([source](https://github.com/jacob-alford/schemata-ts/tree/main/src/schemata/UUID.ts)) (e.g: `1aCa23dc-BBc8-bcBF-5aef-c3Cb6De6c3Eb`, `5a092BB1-CB11-aada-B82b-672Ebc1ADbDa`, `4131F4c7-1653-1bB8-De13-FFcAaFeBDd71`)

### Unit (1)

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@
},
"dependencies": {
"fp-ts": "^2.9.5",
"kuvio": "^1.3.1",
"kuvio": "^2.0.0",
"type-fest": "^4.24.0"
}
}
8 changes: 4 additions & 4 deletions src/schemata/BigIntFromString.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export type BigIntFromStringParams = {
*/
const binaryBigIntString: k.Pattern = pipe(
k.exactString('0b'),
k.then(pipe(k.characterClass(false, ['0', '1']), k.atLeastOne())),
k.andThen(pipe(k.characterClass(false, ['0', '1']), k.atLeastOne())),
)

/**
Expand All @@ -44,7 +44,7 @@ const binaryBigIntString: k.Pattern = pipe(
*/
const octalBigIntString: k.Pattern = pipe(
k.exactString('0o'),
k.then(pipe(k.characterClass(false, ['0', '7']), k.atLeastOne())),
k.andThen(pipe(k.characterClass(false, ['0', '7']), k.atLeastOne())),
)

/**
Expand All @@ -54,7 +54,7 @@ const octalBigIntString: k.Pattern = pipe(
const decimalBigIntString: k.Pattern = pipe(
k.char('-'),
k.maybe,
k.then(pipe(k.digit, k.atLeastOne())),
k.andThen(pipe(k.digit, k.atLeastOne())),
)

/**
Expand All @@ -63,7 +63,7 @@ const decimalBigIntString: k.Pattern = pipe(
*/
const hexBigIntString: k.Pattern = pipe(
k.exactString('0x'),
k.then(pipe(k.hexDigit, k.atLeastOne())),
k.andThen(pipe(k.hexDigit, k.atLeastOne())),
)

/**
Expand Down
4 changes: 2 additions & 2 deletions src/schemata/BitcoinAddress.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export type BitcoinAddress = Branded<string, BitcoinAddressBrand>
*/
const bech32 = pipe(
k.exactString('bc1'),
k.then(pipe(k.characterClass(false, ['a', 'z'], ['0', '9']), k.between(25, 39))),
k.andThen(pipe(k.characterClass(false, ['a', 'z'], ['0', '9']), k.between(25, 39))),
)

/**
Expand All @@ -35,7 +35,7 @@ const bech32 = pipe(
*/
const base58 = pipe(
k.subgroup(k.characterClass(false, ['1', '3'])),
k.then(
k.andThen(
pipe(
k.characterClass(
false,
Expand Down
62 changes: 36 additions & 26 deletions src/schemata/DateFromIsoString.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const year: k.Pattern = pipe(k.digit, k.exactly(4))
const expandedYear: k.Pattern = pipe(
k.characterClass(false, '+', '-'),
k.subgroup,
k.then(pipe(k.digit, k.exactly(6))),
k.andThen(pipe(k.digit, k.exactly(6))),
)

/**
Expand All @@ -42,7 +42,7 @@ const expandedYear: k.Pattern = pipe(
*/
const month: k.Pattern = pipe(
k.char('0'),
k.then(pipe(k.integerRange(1, 9), k.subgroup)),
k.andThen(pipe(k.integerRange(1, 9), k.subgroup)),
k.subgroup,
k.or(pipe(k.integerRange(10, 12), k.subgroup)),
k.subgroup,
Expand All @@ -56,7 +56,7 @@ const month: k.Pattern = pipe(
*/
const day: k.Pattern = pipe(
k.char('0'),
k.then(pipe(k.integerRange(1, 9), k.subgroup)),
k.andThen(pipe(k.integerRange(1, 9), k.subgroup)),
k.subgroup,
k.or(pipe(k.integerRange(10, 31), k.subgroup)),
k.subgroup,
Expand Down Expand Up @@ -102,7 +102,7 @@ const date: k.Pattern = k.subgroup(k.oneOf(yearMonthDay, yearMonth, year, expand
*/
const hour: k.Pattern = pipe(
k.char('0'),
k.then(pipe(k.integerRange(0, 9), k.subgroup)),
k.andThen(pipe(k.integerRange(0, 9), k.subgroup)),
k.subgroup,
k.or(pipe(k.integerRange(10, 23), k.subgroup)),
k.subgroup,
Expand All @@ -116,7 +116,7 @@ const hour: k.Pattern = pipe(
*/
export const minutesSeconds: k.Pattern = pipe(
k.char('0'),
k.then(pipe(k.integerRange(0, 9), k.subgroup)),
k.andThen(pipe(k.integerRange(0, 9), k.subgroup)),
k.subgroup,
k.or(pipe(k.integerRange(10, 59), k.subgroup)),
k.subgroup,
Expand All @@ -139,9 +139,9 @@ const timezoneOffset: k.Pattern = pipe(
k.or(
pipe(
k.characterClass(false, '+', '-'),
k.then(hour),
k.then(k.char(':')),
k.then(minutesSeconds),
k.andThen(hour),
k.andThen(k.char(':')),
k.andThen(minutesSeconds),
),
),
k.subgroup,
Expand All @@ -155,12 +155,12 @@ const timezoneOffset: k.Pattern = pipe(
*/
const hrMinSecMs: k.Pattern = pipe(
hour,
k.then(k.char(':')),
k.then(minutesSeconds),
k.then(k.char(':')),
k.then(minutesSeconds),
k.then(k.char('.')),
k.then(milliseconds),
k.andThen(k.char(':')),
k.andThen(minutesSeconds),
k.andThen(k.char(':')),
k.andThen(minutesSeconds),
k.andThen(k.char('.')),
k.andThen(milliseconds),
)

/**
Expand All @@ -171,10 +171,10 @@ const hrMinSecMs: k.Pattern = pipe(
*/
const hrMinSec: k.Pattern = pipe(
hour,
k.then(k.char(':')),
k.then(minutesSeconds),
k.then(k.char(':')),
k.then(minutesSeconds),
k.andThen(k.char(':')),
k.andThen(minutesSeconds),
k.andThen(k.char(':')),
k.andThen(minutesSeconds),
)

/**
Expand All @@ -183,7 +183,7 @@ const hrMinSec: k.Pattern = pipe(
* @since 1.0.0
* @category Pattern
*/
const hrMin: k.Pattern = pipe(hour, k.then(k.char(':')), k.then(minutesSeconds))
const hrMin: k.Pattern = pipe(hour, k.andThen(k.char(':')), k.andThen(minutesSeconds))

/**
* Iso time string
Expand All @@ -199,8 +199,15 @@ const time: k.Pattern = pipe(hrMinSecMs, k.or(hrMinSec), k.or(hrMin), k.subgroup
*/
const dateTimeStringOptT: k.Pattern = pipe(
date,
k.then(
pipe(k.char('T'), k.or(k.char(' ')), k.subgroup, k.then(time), k.subgroup, k.maybe),
k.andThen(
pipe(
k.char('T'),
k.or(k.char(' ')),
k.subgroup,
k.andThen(time),
k.subgroup,
k.maybe,
),
),
)

Expand All @@ -210,8 +217,8 @@ const dateTimeStringOptT: k.Pattern = pipe(
*/
const dateTimeStringReqT: k.Pattern = pipe(
date,
k.then(pipe(k.char('T'), k.or(k.char(' ')), k.subgroup)),
k.then(time),
k.andThen(pipe(k.char('T'), k.or(k.char(' ')), k.subgroup)),
k.andThen(time),
)

/**
Expand All @@ -220,7 +227,7 @@ const dateTimeStringReqT: k.Pattern = pipe(
*/
const isoDateStringOptTzOptT: k.Pattern = pipe(
dateTimeStringOptT,
k.then(pipe(timezoneOffset, k.maybe)),
k.andThen(pipe(timezoneOffset, k.maybe)),
)

/**
Expand All @@ -229,14 +236,17 @@ const isoDateStringOptTzOptT: k.Pattern = pipe(
*/
const isoDateStringOptTzReqT: k.Pattern = pipe(
dateTimeStringReqT,
k.then(pipe(timezoneOffset, k.maybe)),
k.andThen(pipe(timezoneOffset, k.maybe)),
)

/**
* @since 1.0.0
* @category Pattern
*/
const isoDateStringReqTzReqT: k.Pattern = pipe(dateTimeStringReqT, k.then(timezoneOffset))
const isoDateStringReqTzReqT: k.Pattern = pipe(
dateTimeStringReqT,
k.andThen(timezoneOffset),
)

/**
* @since 1.0.0
Expand Down
28 changes: 18 additions & 10 deletions src/schemata/FloatFromString.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,10 @@ export type FloatString<Min = MaxNegativeFloat, Max = MaxPositiveFloat> = Brande
*/
const negativeFloatLeft: k.Pattern = pipe(
k.char('-'),
k.then(pipe(k.digit, k.between(1, 308))),
k.then(pipe(k.char('.'), k.then(pipe(k.digit, k.anyNumber())), k.subgroup, k.maybe)),
k.andThen(pipe(k.digit, k.between(1, 308))),
k.andThen(
pipe(k.char('.'), k.andThen(pipe(k.digit, k.anyNumber())), k.subgroup, k.maybe),
),
)

/**
Expand All @@ -54,8 +56,10 @@ const negativeFloatLeft: k.Pattern = pipe(
*/
const negativeFloatRight: k.Pattern = pipe(
k.char('-'),
k.then(pipe(k.digit, k.between(0, 308))),
k.then(pipe(k.char('.'), k.then(pipe(k.digit, k.atLeastOne())), k.subgroup, k.maybe)),
k.andThen(pipe(k.digit, k.between(0, 308))),
k.andThen(
pipe(k.char('.'), k.andThen(pipe(k.digit, k.atLeastOne())), k.subgroup, k.maybe),
),
)

/**
Expand All @@ -69,7 +73,9 @@ const negativeFloatRight: k.Pattern = pipe(
const positiveFloatLeft: k.Pattern = pipe(
k.digit,
k.between(1, 308),
k.then(pipe(k.char('.'), k.then(pipe(k.digit, k.anyNumber())), k.subgroup, k.maybe)),
k.andThen(
pipe(k.char('.'), k.andThen(pipe(k.digit, k.anyNumber())), k.subgroup, k.maybe),
),
)

/**
Expand All @@ -83,7 +89,9 @@ const positiveFloatLeft: k.Pattern = pipe(
const positiveFloatRight: k.Pattern = pipe(
k.digit,
k.between(0, 308),
k.then(pipe(k.char('.'), k.then(pipe(k.digit, k.atLeastOne())), k.subgroup, k.maybe)),
k.andThen(
pipe(k.char('.'), k.andThen(pipe(k.digit, k.atLeastOne())), k.subgroup, k.maybe),
),
)

/**
Expand All @@ -104,7 +112,7 @@ const decimalFloat: k.Pattern = k.oneOf(
const positiveExponential: k.Pattern = pipe(
k.char('+'),
k.maybe,
k.then(pipe(k.integerRange(0, 308), k.subgroup)),
k.andThen(pipe(k.integerRange(0, 308), k.subgroup)),
)

/**
Expand All @@ -113,7 +121,7 @@ const positiveExponential: k.Pattern = pipe(
*/
const negativeExponential: k.Pattern = pipe(
k.char('-'),
k.then(pipe(k.digit, k.atLeastOne(), k.subgroup)),
k.andThen(pipe(k.digit, k.atLeastOne(), k.subgroup)),
)

/**
Expand All @@ -123,10 +131,10 @@ const negativeExponential: k.Pattern = pipe(
const floatFromString: k.Pattern = pipe(
decimalFloat,
k.subgroup,
k.then(
k.andThen(
pipe(
k.char('e'),
k.then(pipe(k.oneOf(positiveExponential, negativeExponential), k.subgroup)),
k.andThen(pipe(k.oneOf(positiveExponential, negativeExponential), k.subgroup)),
k.subgroup,
k.maybe,
),
Expand Down
8 changes: 4 additions & 4 deletions src/schemata/IntFromString.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export type IntString<Min = MinSafeInt, Max = MaxSafeInt> = Branded<
*/
const binaryIntString: k.Pattern = pipe(
k.exactString('0b'),
k.then(pipe(k.characterClass(false, ['0', '1']), k.between(1, 53))),
k.andThen(pipe(k.characterClass(false, ['0', '1']), k.between(1, 53))),
)

/**
Expand All @@ -41,7 +41,7 @@ const binaryIntString: k.Pattern = pipe(
*/
const octalIntString: k.Pattern = pipe(
k.exactString('0o'),
k.then(pipe(k.characterClass(false, ['0', '7']), k.between(1, 18))),
k.andThen(pipe(k.characterClass(false, ['0', '7']), k.between(1, 18))),
)

/**
Expand All @@ -51,7 +51,7 @@ const octalIntString: k.Pattern = pipe(
const decimalIntString: k.Pattern = pipe(
k.char('-'),
k.maybe,
k.then(pipe(k.digit, k.between(1, 16))),
k.andThen(pipe(k.digit, k.between(1, 16))),
)

/**
Expand All @@ -60,7 +60,7 @@ const decimalIntString: k.Pattern = pipe(
*/
const hexIntString: k.Pattern = pipe(
k.exactString('0x'),
k.then(pipe(k.hexDigit, k.between(1, 14))),
k.andThen(pipe(k.hexDigit, k.between(1, 14))),
)

/**
Expand Down
3 changes: 2 additions & 1 deletion tests/Base64.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ runStandardTestSuite(S.Base64, _ => ({
guardTests: [],
eqTests: [],
jsonSchema: JS.string({
pattern: '^(([A-Za-z0-9+/]{4})*?([A-Za-z0-9+/]{2}={2}|[A-Za-z0-9+/]{3}=)?)$',
pattern:
'^(([A-Za-z0-9+\\x2f]{4})*?([A-Za-z0-9+\\x2f]{2}={2}|[A-Za-z0-9+\\x2f]{3}=)?)$',
}),
typeString: 'Base64',
}))()
2 changes: 1 addition & 1 deletion tests/EmailAddress.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ runStandardTestSuite(S.EmailAddress, _ => ({
eqTests: [],
jsonSchema: JS.string({
pattern:
'^(([A-Za-z0-9!#$%&\'*+\\x2d/=?\\x5e_`{|}~]+(\\.[A-Za-z0-9!#$%&\'*+\\x2d/=?\\x5e_`{|}~]+)*|"[^"\\x00-\\x1f]+")@(\\[\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\]|([A-Za-z0-9\\x2d]{0,63}\\.)+[A-Za-z]{2,}))$',
'^(([A-Za-z0-9!#$%&\'*+\\x2d\\x2f=?\\x5e_`{|}~]+(\\.[A-Za-z0-9!#$%&\'*+\\x2d\\x2f=?\\x5e_`{|}~]+)*|"[^"\\x00-\\x1f]+")@(\\[\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\]|([A-Za-z0-9\\x2d]{0,63}\\.)+[A-Za-z]{2,}))$',
}),
typeString: 'EmailAddress',
}))()
Loading

0 comments on commit 2008064

Please sign in to comment.