diff --git a/.node-version b/.node-version new file mode 100644 index 00000000..23670da1 --- /dev/null +++ b/.node-version @@ -0,0 +1 @@ +18.20.4 \ No newline at end of file diff --git a/docs/schemata/index.md b/docs/schemata/index.md index 3d1f0b7d..79342962 100644 --- a/docs/schemata/index.md +++ b/docs/schemata/index.md @@ -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.*Gsx`, `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&~@B..M.snHtA`, `"뜐"@[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) diff --git a/package.json b/package.json index a63376f1..a63fddb8 100644 --- a/package.json +++ b/package.json @@ -122,7 +122,7 @@ }, "dependencies": { "fp-ts": "^2.9.5", - "kuvio": "^1.3.1", + "kuvio": "^2.0.0", "type-fest": "^4.24.0" } } diff --git a/src/schemata/BigIntFromString.ts b/src/schemata/BigIntFromString.ts index f3784965..31b6967c 100644 --- a/src/schemata/BigIntFromString.ts +++ b/src/schemata/BigIntFromString.ts @@ -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())), ) /** @@ -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())), ) /** @@ -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())), ) /** @@ -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())), ) /** diff --git a/src/schemata/BitcoinAddress.ts b/src/schemata/BitcoinAddress.ts index 29d579e2..99373fa5 100644 --- a/src/schemata/BitcoinAddress.ts +++ b/src/schemata/BitcoinAddress.ts @@ -25,7 +25,7 @@ export type BitcoinAddress = Branded */ 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))), ) /** @@ -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, diff --git a/src/schemata/DateFromIsoString.ts b/src/schemata/DateFromIsoString.ts index dd2ab825..1ba2e3f2 100644 --- a/src/schemata/DateFromIsoString.ts +++ b/src/schemata/DateFromIsoString.ts @@ -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))), ) /** @@ -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, @@ -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, @@ -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, @@ -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, @@ -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, @@ -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), ) /** @@ -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), ) /** @@ -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 @@ -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, + ), ), ) @@ -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), ) /** @@ -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)), ) /** @@ -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 diff --git a/src/schemata/FloatFromString.ts b/src/schemata/FloatFromString.ts index daa8d445..b6b10aa2 100644 --- a/src/schemata/FloatFromString.ts +++ b/src/schemata/FloatFromString.ts @@ -40,8 +40,10 @@ export type FloatString = 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), + ), ) /** @@ -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), + ), ) /** @@ -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), + ), ) /** @@ -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), + ), ) /** @@ -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)), ) /** @@ -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)), ) /** @@ -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, ), diff --git a/src/schemata/IntFromString.ts b/src/schemata/IntFromString.ts index f9ee270b..abc27ac5 100644 --- a/src/schemata/IntFromString.ts +++ b/src/schemata/IntFromString.ts @@ -32,7 +32,7 @@ export type IntString = 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))), ) /** @@ -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))), ) /** @@ -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))), ) /** @@ -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))), ) /** diff --git a/tests/Base64.test.ts b/tests/Base64.test.ts index 28538179..b8150665 100644 --- a/tests/Base64.test.ts +++ b/tests/Base64.test.ts @@ -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', }))() diff --git a/tests/EmailAddress.test.ts b/tests/EmailAddress.test.ts index 56ab1464..904b7ebe 100644 --- a/tests/EmailAddress.test.ts +++ b/tests/EmailAddress.test.ts @@ -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', }))() diff --git a/tests/Union.test.ts b/tests/Union.test.ts index cbf58e05..fc436a1d 100644 --- a/tests/Union.test.ts +++ b/tests/Union.test.ts @@ -159,7 +159,7 @@ runStandardTestSuite(NotMutex, _ => ({ { a: 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,}))$', }), c: JS.number({ minimum: -8640000000000, diff --git a/yarn.lock b/yarn.lock index b37acb8b..23ff343e 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1835,14 +1835,6 @@ "@sagold/json-pointer" "^5.0.0" ebnf "^1.9.0" -"@simspace/matchers@^0.0.4": - version "0.0.4" - resolved "https://registry.yarnpkg.com/@simspace/matchers/-/matchers-0.0.4.tgz#b219dc0795bbfd525d96c2f58f63eb532a358c46" - integrity sha512-WYCbqmN+WaUKaZoCtiRP8AnAd7pM/jX2EM24m37ghodhYdXhas9LdrH00nqjlbkS9YShcAYNHjw3F1zyQ94NcQ== - dependencies: - fp-ts "^2.11" - typelevel-ts "^0.4.0" - "@sinclair/typebox@^0.25.16": version "0.25.24" resolved "https://registry.yarnpkg.com/@sinclair/typebox/-/typebox-0.25.24.tgz#8c7688559979f7079aacaf31aa881c3aa410b718" @@ -3695,7 +3687,7 @@ format@^0.2.0: resolved "https://registry.yarnpkg.com/format/-/format-0.2.2.tgz#d6170107e9efdc4ed30c9dc39016df942b5cb58b" integrity sha512-wzsgA6WOq+09wrU1tsJ09udeR/YZRaeArL9e1wPbFg3GG2yDnC2ldKpxs4xunpFF9DgqCqOIra3bc1HWrJ37Ww== -fp-ts@^2.11, fp-ts@^2.13.1, fp-ts@^2.15.0, fp-ts@^2.9.5: +fp-ts@^2.15.0, fp-ts@^2.9.5: version "2.16.0" resolved "https://registry.yarnpkg.com/fp-ts/-/fp-ts-2.16.0.tgz#64e03314dfc1c7ce5e975d3496ac14bc3eb7f92e" integrity sha512-bLq+KgbiXdTEoT1zcARrWEpa5z6A/8b7PcDW7Gef3NSisQ+VS7ll2Xbf1E+xsgik0rWub/8u0qP/iTTjj+PhxQ== @@ -4953,13 +4945,10 @@ kleur@^4.0.3: resolved "https://registry.yarnpkg.com/kleur/-/kleur-4.1.5.tgz#95106101795f7050c6c650f350c683febddb1780" integrity sha512-o+NO+8WrRiQEE4/7nwRJhN1HWpVmJm511pBHUxPLtp0BUISzlBplORYSmTclCnJvQq2tKu/sgl3xVpkc7ZWuQQ== -kuvio@^1.3.1: - version "1.3.1" - resolved "https://registry.yarnpkg.com/kuvio/-/kuvio-1.3.1.tgz#6f5516c6c6696421a372d1cd4c0293a8e061c618" - integrity sha512-ta6NhQwo2qkWOokqO4L3Z4rlpYbdztCEfH1fQCvvTKX7lRYreoSUuJmwDVVZpVPSNa8n43SLt5XCX1kEcIGy9w== - dependencies: - "@simspace/matchers" "^0.0.4" - fp-ts "^2.13.1" +kuvio@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/kuvio/-/kuvio-2.0.0.tgz#fb73d7a17eb32f491d248d2179ce46459c3d24cf" + integrity sha512-PC6LhfPGrhohyAnKBedRakAJhiJANniSpb8InM6H6mhtE82QHn6ASSeAnpxNObCKdNMKNWAwQAsd8p8q+N4HAg== lazy-cache@^2.0.2: version "2.0.2" @@ -6844,11 +6833,6 @@ typedarray@^0.0.6: resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777" integrity sha512-/aCDEGatGvZ2BIk+HmLf4ifCJFwvKFNb9/JeZPMulfgFracn9QFcAf5GO8B/mweUjSoblS5In0cWhqpfs/5PQA== -typelevel-ts@^0.4.0: - version "0.4.0" - resolved "https://registry.yarnpkg.com/typelevel-ts/-/typelevel-ts-0.4.0.tgz#5a757bd74a3484b42b6992a27c038e7a34330b5d" - integrity sha512-Qn4EgOuc7lrzjgJYc7arwteuZutO18zFyhVj4/6+BEhPr07BMsqaM02LuuRCVFP1ud5tbDYGn/Vr/BAYnGOSqw== - typescript@^5.1.0: version "5.1.3" resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.1.3.tgz#8d84219244a6b40b6fb2b33cc1c062f715b9e826"