bguard 0.0.9 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +844 -26
- package/lib/{CommonSchema-BIe85W_A.d.mts → CommonSchema-BbGNki0L.d.ts} +7 -4
- package/lib/{CommonSchema-BIe85W_A.d.ts → CommonSchema-CjsYE4dC.d.mts} +7 -4
- package/lib/InferType.d.mts +2 -1
- package/lib/InferType.d.ts +2 -1
- package/lib/asserts/array/index.d.mts +4 -3
- package/lib/asserts/array/index.d.ts +4 -3
- package/lib/asserts/array/index.js +6 -6
- package/lib/asserts/array/index.mjs +5 -5
- package/lib/asserts/boolean/index.d.mts +4 -3
- package/lib/asserts/boolean/index.d.ts +4 -3
- package/lib/asserts/boolean/index.js +7 -6
- package/lib/asserts/boolean/index.js.map +1 -1
- package/lib/asserts/boolean/index.mjs +6 -5
- package/lib/asserts/mix/equalTo.d.mts +22 -0
- package/lib/asserts/mix/equalTo.d.ts +22 -0
- package/lib/asserts/mix/equalTo.js +9 -0
- package/lib/asserts/mix/equalTo.js.map +1 -0
- package/lib/asserts/mix/equalTo.mjs +9 -0
- package/lib/asserts/{common → mix}/index.d.mts +5 -4
- package/lib/asserts/{common → mix}/index.d.ts +5 -4
- package/lib/asserts/mix/index.js +10 -0
- package/lib/asserts/mix/index.js.map +1 -0
- package/lib/asserts/mix/index.mjs +10 -0
- package/lib/asserts/mix/oneOfValues.d.mts +23 -0
- package/lib/asserts/mix/oneOfValues.d.ts +23 -0
- package/lib/asserts/mix/oneOfValues.js +9 -0
- package/lib/asserts/mix/oneOfValues.js.map +1 -0
- package/lib/asserts/mix/oneOfValues.mjs +9 -0
- package/lib/asserts/number/index.d.mts +4 -3
- package/lib/asserts/number/index.d.ts +4 -3
- package/lib/asserts/number/index.js +11 -7
- package/lib/asserts/number/index.js.map +1 -1
- package/lib/asserts/number/index.mjs +10 -6
- package/lib/asserts/number/max.d.mts +15 -10
- package/lib/asserts/number/max.d.ts +15 -10
- package/lib/asserts/number/max.js +11 -4
- package/lib/asserts/number/max.js.map +1 -1
- package/lib/asserts/number/max.mjs +12 -5
- package/lib/asserts/number/max.mjs.map +1 -1
- package/lib/asserts/number/maxExcluded.d.mts +14 -9
- package/lib/asserts/number/maxExcluded.d.ts +14 -9
- package/lib/asserts/number/maxExcluded.js +11 -4
- package/lib/asserts/number/maxExcluded.js.map +1 -1
- package/lib/asserts/number/maxExcluded.mjs +12 -5
- package/lib/asserts/number/maxExcluded.mjs.map +1 -1
- package/lib/asserts/number/min.d.mts +15 -10
- package/lib/asserts/number/min.d.ts +15 -10
- package/lib/asserts/number/min.js +11 -4
- package/lib/asserts/number/min.js.map +1 -1
- package/lib/asserts/number/min.mjs +12 -5
- package/lib/asserts/number/min.mjs.map +1 -1
- package/lib/asserts/number/minExcluded.d.mts +15 -10
- package/lib/asserts/number/minExcluded.d.ts +15 -10
- package/lib/asserts/number/minExcluded.js +11 -4
- package/lib/asserts/number/minExcluded.js.map +1 -1
- package/lib/asserts/number/minExcluded.mjs +12 -5
- package/lib/asserts/number/minExcluded.mjs.map +1 -1
- package/lib/asserts/number/negative.d.mts +14 -9
- package/lib/asserts/number/negative.d.ts +14 -9
- package/lib/asserts/number/negative.js +11 -3
- package/lib/asserts/number/negative.js.map +1 -1
- package/lib/asserts/number/negative.mjs +12 -4
- package/lib/asserts/number/negative.mjs.map +1 -1
- package/lib/asserts/number/positive.d.mts +14 -9
- package/lib/asserts/number/positive.d.ts +14 -9
- package/lib/asserts/number/positive.js +11 -3
- package/lib/asserts/number/positive.js.map +1 -1
- package/lib/asserts/number/positive.mjs +12 -4
- package/lib/asserts/number/positive.mjs.map +1 -1
- package/lib/asserts/object/index.d.mts +4 -3
- package/lib/asserts/object/index.d.ts +4 -3
- package/lib/asserts/object/index.js +6 -6
- package/lib/asserts/object/index.mjs +5 -5
- package/lib/asserts/string/atLeastOneDigit.d.mts +20 -0
- package/lib/asserts/string/atLeastOneDigit.d.ts +20 -0
- package/lib/asserts/string/atLeastOneDigit.js +21 -0
- package/lib/asserts/string/atLeastOneDigit.js.map +1 -0
- package/lib/asserts/string/atLeastOneDigit.mjs +21 -0
- package/lib/asserts/string/atLeastOneDigit.mjs.map +1 -0
- package/lib/asserts/string/atLeastOneLowerChar.d.mts +20 -0
- package/lib/asserts/string/atLeastOneLowerChar.d.ts +20 -0
- package/lib/asserts/string/atLeastOneLowerChar.js +22 -0
- package/lib/asserts/string/atLeastOneLowerChar.js.map +1 -0
- package/lib/asserts/string/atLeastOneLowerChar.mjs +22 -0
- package/lib/asserts/string/atLeastOneLowerChar.mjs.map +1 -0
- package/lib/asserts/string/atLeastOneSpecialChar.d.mts +25 -0
- package/lib/asserts/string/atLeastOneSpecialChar.d.ts +25 -0
- package/lib/asserts/string/atLeastOneSpecialChar.js +26 -0
- package/lib/asserts/string/atLeastOneSpecialChar.js.map +1 -0
- package/lib/asserts/string/atLeastOneSpecialChar.mjs +26 -0
- package/lib/asserts/string/atLeastOneSpecialChar.mjs.map +1 -0
- package/lib/asserts/string/atLeastOneUpperChar.d.mts +20 -0
- package/lib/asserts/string/atLeastOneUpperChar.d.ts +20 -0
- package/lib/asserts/string/atLeastOneUpperChar.js +22 -0
- package/lib/asserts/string/atLeastOneUpperChar.js.map +1 -0
- package/lib/asserts/string/atLeastOneUpperChar.mjs +22 -0
- package/lib/asserts/string/atLeastOneUpperChar.mjs.map +1 -0
- package/lib/asserts/string/contains.d.mts +21 -0
- package/lib/asserts/string/contains.d.ts +21 -0
- package/lib/asserts/string/contains.js +22 -0
- package/lib/asserts/string/contains.js.map +1 -0
- package/lib/asserts/string/contains.mjs +22 -0
- package/lib/asserts/string/contains.mjs.map +1 -0
- package/lib/asserts/string/email.d.mts +13 -9
- package/lib/asserts/string/email.d.ts +13 -9
- package/lib/asserts/string/email.js +11 -4
- package/lib/asserts/string/email.js.map +1 -1
- package/lib/asserts/string/email.mjs +12 -5
- package/lib/asserts/string/email.mjs.map +1 -1
- package/lib/asserts/string/endsWith.d.mts +21 -0
- package/lib/asserts/string/endsWith.d.ts +21 -0
- package/lib/asserts/string/endsWith.js +22 -0
- package/lib/asserts/string/endsWith.js.map +1 -0
- package/lib/asserts/string/endsWith.mjs +22 -0
- package/lib/asserts/string/endsWith.mjs.map +1 -0
- package/lib/asserts/string/index.d.mts +4 -3
- package/lib/asserts/string/index.d.ts +4 -3
- package/lib/asserts/string/index.js +11 -7
- package/lib/asserts/string/index.js.map +1 -1
- package/lib/asserts/string/index.mjs +10 -6
- package/lib/asserts/string/lowerCase.d.mts +20 -0
- package/lib/asserts/string/lowerCase.d.ts +20 -0
- package/lib/asserts/string/lowerCase.js +20 -0
- package/lib/asserts/string/lowerCase.js.map +1 -0
- package/lib/asserts/string/lowerCase.mjs +20 -0
- package/lib/asserts/string/lowerCase.mjs.map +1 -0
- package/lib/asserts/string/maxLength.d.mts +14 -9
- package/lib/asserts/string/maxLength.d.ts +14 -9
- package/lib/asserts/string/maxLength.js +11 -4
- package/lib/asserts/string/maxLength.js.map +1 -1
- package/lib/asserts/string/maxLength.mjs +12 -5
- package/lib/asserts/string/maxLength.mjs.map +1 -1
- package/lib/asserts/string/minLength.d.mts +14 -9
- package/lib/asserts/string/minLength.d.ts +14 -9
- package/lib/asserts/string/minLength.js +11 -4
- package/lib/asserts/string/minLength.js.map +1 -1
- package/lib/asserts/string/minLength.mjs +12 -5
- package/lib/asserts/string/minLength.mjs.map +1 -1
- package/lib/asserts/string/regExp.d.mts +14 -9
- package/lib/asserts/string/regExp.d.ts +14 -9
- package/lib/asserts/string/regExp.js +11 -4
- package/lib/asserts/string/regExp.js.map +1 -1
- package/lib/asserts/string/regExp.mjs +12 -5
- package/lib/asserts/string/regExp.mjs.map +1 -1
- package/lib/asserts/string/startsWith.d.mts +21 -0
- package/lib/asserts/string/startsWith.d.ts +21 -0
- package/lib/asserts/string/startsWith.js +22 -0
- package/lib/asserts/string/startsWith.js.map +1 -0
- package/lib/asserts/string/startsWith.mjs +22 -0
- package/lib/asserts/string/startsWith.mjs.map +1 -0
- package/lib/asserts/string/upperCase.d.mts +21 -0
- package/lib/asserts/string/upperCase.d.ts +21 -0
- package/lib/asserts/string/upperCase.js +22 -0
- package/lib/asserts/string/upperCase.js.map +1 -0
- package/lib/asserts/string/upperCase.mjs +22 -0
- package/lib/asserts/string/upperCase.mjs.map +1 -0
- package/lib/asserts/string/uuid.d.mts +20 -0
- package/lib/asserts/string/uuid.d.ts +20 -0
- package/lib/asserts/string/uuid.js +23 -0
- package/lib/asserts/string/uuid.js.map +1 -0
- package/lib/asserts/string/uuid.mjs +23 -0
- package/lib/asserts/string/uuid.mjs.map +1 -0
- package/lib/asserts/string/uuidV1.d.mts +21 -0
- package/lib/asserts/string/uuidV1.d.ts +21 -0
- package/lib/asserts/string/uuidV1.js +23 -0
- package/lib/asserts/string/uuidV1.js.map +1 -0
- package/lib/asserts/string/uuidV1.mjs +23 -0
- package/lib/asserts/string/uuidV1.mjs.map +1 -0
- package/lib/asserts/string/uuidV2.d.mts +21 -0
- package/lib/asserts/string/uuidV2.d.ts +21 -0
- package/lib/asserts/string/uuidV2.js +23 -0
- package/lib/asserts/string/uuidV2.js.map +1 -0
- package/lib/asserts/string/uuidV2.mjs +23 -0
- package/lib/asserts/string/uuidV2.mjs.map +1 -0
- package/lib/asserts/string/uuidV3.d.mts +21 -0
- package/lib/asserts/string/uuidV3.d.ts +21 -0
- package/lib/asserts/string/uuidV3.js +23 -0
- package/lib/asserts/string/uuidV3.js.map +1 -0
- package/lib/asserts/string/uuidV3.mjs +23 -0
- package/lib/asserts/string/uuidV3.mjs.map +1 -0
- package/lib/asserts/string/uuidV4.d.mts +23 -0
- package/lib/asserts/string/uuidV4.d.ts +23 -0
- package/lib/asserts/string/uuidV4.js +23 -0
- package/lib/asserts/string/uuidV4.js.map +1 -0
- package/lib/asserts/string/uuidV4.mjs +23 -0
- package/lib/asserts/string/uuidV4.mjs.map +1 -0
- package/lib/asserts/string/uuidV5.d.mts +21 -0
- package/lib/asserts/string/uuidV5.d.ts +21 -0
- package/lib/asserts/string/uuidV5.js +23 -0
- package/lib/asserts/string/uuidV5.js.map +1 -0
- package/lib/asserts/string/uuidV5.mjs +23 -0
- package/lib/asserts/string/uuidV5.mjs.map +1 -0
- package/lib/asserts/string/validUrl.d.mts +23 -0
- package/lib/asserts/string/validUrl.d.ts +23 -0
- package/lib/asserts/string/validUrl.js +32 -0
- package/lib/asserts/string/validUrl.js.map +1 -0
- package/lib/asserts/string/validUrl.mjs +32 -0
- package/lib/asserts/string/validUrl.mjs.map +1 -0
- package/lib/{chunk-32IQXZRK.mjs → chunk-2PM3K3OE.mjs} +2 -2
- package/lib/{chunk-32IQXZRK.mjs.map → chunk-2PM3K3OE.mjs.map} +1 -1
- package/lib/{chunk-KCBOOOTF.mjs → chunk-32RSTOZ4.mjs} +2 -2
- package/lib/{chunk-KCBOOOTF.mjs.map → chunk-32RSTOZ4.mjs.map} +1 -1
- package/lib/chunk-3HTYHE2X.mjs +54 -0
- package/lib/chunk-3HTYHE2X.mjs.map +1 -0
- package/lib/chunk-3O4WCRC2.mjs +21 -0
- package/lib/chunk-3O4WCRC2.mjs.map +1 -0
- package/lib/chunk-42J6CHIO.js +7 -0
- package/lib/chunk-42J6CHIO.js.map +1 -0
- package/lib/chunk-4CYIMDP2.js +21 -0
- package/lib/chunk-4CYIMDP2.js.map +1 -0
- package/lib/chunk-5BVJ6YMH.js +54 -0
- package/lib/chunk-5BVJ6YMH.js.map +1 -0
- package/lib/chunk-6TH3DBDK.js +53 -0
- package/lib/chunk-6TH3DBDK.js.map +1 -0
- package/lib/chunk-7XFLH6R2.mjs +44 -0
- package/lib/chunk-7XFLH6R2.mjs.map +1 -0
- package/lib/chunk-ASZW6XRM.mjs +7 -0
- package/lib/chunk-ASZW6XRM.mjs.map +1 -0
- package/lib/{chunk-GEZME6V2.mjs → chunk-CCBCDJXS.mjs} +11 -6
- package/lib/chunk-CCBCDJXS.mjs.map +1 -0
- package/lib/chunk-DJSLA2ZV.js +27 -0
- package/lib/chunk-DJSLA2ZV.js.map +1 -0
- package/lib/{chunk-L7HUXYFV.mjs → chunk-DPBE7TAQ.mjs} +2 -2
- package/lib/chunk-DPBE7TAQ.mjs.map +1 -0
- package/lib/{chunk-APTTIN2L.js → chunk-EGEHSELT.js} +6 -6
- package/lib/chunk-EGEHSELT.js.map +1 -0
- package/lib/chunk-H7CPKW53.js +47 -0
- package/lib/chunk-H7CPKW53.js.map +1 -0
- package/lib/{chunk-A7I2JEQO.js → chunk-HDSGCAHH.js} +3 -3
- package/lib/{chunk-A7I2JEQO.js.map → chunk-HDSGCAHH.js.map} +1 -1
- package/lib/{chunk-L6A7NXUJ.js → chunk-IEUXIOL6.js} +3 -3
- package/lib/{chunk-L6A7NXUJ.js.map → chunk-IEUXIOL6.js.map} +1 -1
- package/lib/chunk-IRG4OQAB.js +63 -0
- package/lib/chunk-IRG4OQAB.js.map +1 -0
- package/lib/chunk-J4VKFJQK.js +21 -0
- package/lib/chunk-J4VKFJQK.js.map +1 -0
- package/lib/{chunk-A2SAWKJA.mjs → chunk-JDGZCBXF.mjs} +2 -2
- package/lib/{chunk-A2SAWKJA.mjs.map → chunk-JDGZCBXF.mjs.map} +1 -1
- package/lib/chunk-JPRCULRQ.mjs +61 -0
- package/lib/chunk-JPRCULRQ.mjs.map +1 -0
- package/lib/chunk-JSGZ7DKT.js +14 -0
- package/lib/chunk-JSGZ7DKT.js.map +1 -0
- package/lib/chunk-KQKJASVB.js +58 -0
- package/lib/chunk-KQKJASVB.js.map +1 -0
- package/lib/chunk-LEQCDD66.js +61 -0
- package/lib/chunk-LEQCDD66.js.map +1 -0
- package/lib/{chunk-AJ4WV5DG.mjs → chunk-MRISXZQ4.mjs} +3 -3
- package/lib/chunk-MRISXZQ4.mjs.map +1 -0
- package/lib/{chunk-A3UTB4RE.mjs → chunk-NDQM5OL4.mjs} +4 -4
- package/lib/chunk-NDQM5OL4.mjs.map +1 -0
- package/lib/chunk-NNFYXHLU.mjs +21 -0
- package/lib/chunk-NNFYXHLU.mjs.map +1 -0
- package/lib/chunk-P7IXNCJG.mjs +58 -0
- package/lib/chunk-P7IXNCJG.mjs.map +1 -0
- package/lib/chunk-PG2R7P7G.mjs +27 -0
- package/lib/chunk-PG2R7P7G.mjs.map +1 -0
- package/lib/chunk-PH2PMUZP.mjs +63 -0
- package/lib/chunk-PH2PMUZP.mjs.map +1 -0
- package/lib/{chunk-BGMR7A6X.mjs → chunk-PXBAS3GA.mjs} +2 -2
- package/lib/{chunk-BGMR7A6X.mjs.map → chunk-PXBAS3GA.mjs.map} +1 -1
- package/lib/chunk-QQNQ4IDN.js +13 -0
- package/lib/chunk-QQNQ4IDN.js.map +1 -0
- package/lib/{chunk-QKGQ4XZC.js → chunk-RD6TBCPQ.js} +3 -3
- package/lib/{chunk-QKGQ4XZC.js.map → chunk-RD6TBCPQ.js.map} +1 -1
- package/lib/chunk-RRQOET3X.js +28 -0
- package/lib/chunk-RRQOET3X.js.map +1 -0
- package/lib/chunk-RYVUYVEE.mjs +14 -0
- package/lib/chunk-RYVUYVEE.mjs.map +1 -0
- package/lib/{chunk-QYLH5ZAC.mjs → chunk-TCQY2R3U.mjs} +25 -4
- package/lib/chunk-TCQY2R3U.mjs.map +1 -0
- package/lib/{chunk-PJP63SJT.js → chunk-TKZ6FLLR.js} +3 -3
- package/lib/{chunk-PJP63SJT.js.map → chunk-TKZ6FLLR.js.map} +1 -1
- package/lib/{chunk-K2S3FS5K.js → chunk-VHEA4JZ5.js} +3 -3
- package/lib/{chunk-K2S3FS5K.js.map → chunk-VHEA4JZ5.js.map} +1 -1
- package/lib/{chunk-VPFIIM2X.js → chunk-WBERBAL4.js} +11 -6
- package/lib/chunk-WBERBAL4.js.map +1 -0
- package/lib/chunk-WK4O3HH4.js +44 -0
- package/lib/chunk-WK4O3HH4.js.map +1 -0
- package/lib/{chunk-3FEJUC3K.mjs → chunk-YML32TPA.mjs} +2 -2
- package/lib/{chunk-3FEJUC3K.mjs.map → chunk-YML32TPA.mjs.map} +1 -1
- package/lib/chunk-YUESB2WV.mjs +47 -0
- package/lib/chunk-YUESB2WV.mjs.map +1 -0
- package/lib/codeGen.d.mts +7 -0
- package/lib/codeGen.d.ts +7 -0
- package/lib/codeGen.js +51 -0
- package/lib/codeGen.js.map +1 -0
- package/lib/codeGen.mjs +51 -0
- package/lib/codeGen.mjs.map +1 -0
- package/lib/commonTypes.d.mts +31 -0
- package/lib/commonTypes.d.ts +31 -0
- package/lib/commonTypes.js +1 -0
- package/lib/commonTypes.js.map +1 -0
- package/lib/commonTypes.mjs +1 -0
- package/lib/exceptions.d.mts +4 -2
- package/lib/exceptions.d.ts +4 -2
- package/lib/exceptions.js +2 -2
- package/lib/exceptions.mjs +3 -3
- package/lib/helpers/constants.d.mts +3 -0
- package/lib/helpers/constants.d.ts +3 -0
- package/lib/helpers/constants.js +7 -0
- package/lib/helpers/constants.js.map +1 -0
- package/lib/helpers/constants.mjs +7 -0
- package/lib/helpers/constants.mjs.map +1 -0
- package/lib/helpers/core.d.mts +2 -0
- package/lib/helpers/core.d.ts +2 -0
- package/lib/helpers/core.js +10 -0
- package/lib/helpers/core.js.map +1 -0
- package/lib/helpers/core.mjs +10 -0
- package/lib/helpers/core.mjs.map +1 -0
- package/lib/helpers/setStrictType.d.mts +6 -0
- package/lib/helpers/setStrictType.d.ts +6 -0
- package/lib/helpers/setStrictType.js +9 -0
- package/lib/helpers/setStrictType.js.map +1 -0
- package/lib/helpers/setStrictType.mjs +9 -0
- package/lib/helpers/setStrictType.mjs.map +1 -0
- package/lib/index.d.mts +7 -4
- package/lib/index.d.ts +7 -4
- package/lib/index.js +32 -17
- package/lib/index.js.map +1 -1
- package/lib/index.mjs +37 -22
- package/lib/parse.d.mts +66 -0
- package/lib/parse.d.ts +66 -0
- package/lib/parse.js +10 -0
- package/lib/parse.js.map +1 -0
- package/lib/parse.mjs +10 -0
- package/lib/parse.mjs.map +1 -0
- package/lib/{parseSchema.d.mts → parseOrFail.d.mts} +16 -5
- package/lib/{parseSchema.d.ts → parseOrFail.d.ts} +16 -5
- package/lib/parseOrFail.js +10 -0
- package/lib/parseOrFail.js.map +1 -0
- package/lib/parseOrFail.mjs +10 -0
- package/lib/parseOrFail.mjs.map +1 -0
- package/lib/schemas/ArraySchema.d.mts +2 -1
- package/lib/schemas/ArraySchema.d.ts +2 -1
- package/lib/schemas/ArraySchema.js +5 -5
- package/lib/schemas/ArraySchema.mjs +4 -4
- package/lib/schemas/BooleanSchema.d.mts +2 -1
- package/lib/schemas/BooleanSchema.d.ts +2 -1
- package/lib/schemas/BooleanSchema.js +6 -5
- package/lib/schemas/BooleanSchema.js.map +1 -1
- package/lib/schemas/BooleanSchema.mjs +5 -4
- package/lib/schemas/CommonSchema.d.mts +2 -1
- package/lib/schemas/CommonSchema.d.ts +2 -1
- package/lib/schemas/CommonSchema.js +4 -4
- package/lib/schemas/CommonSchema.mjs +3 -3
- package/lib/schemas/NumberSchema.d.mts +13 -1
- package/lib/schemas/NumberSchema.d.ts +13 -1
- package/lib/schemas/NumberSchema.js +10 -6
- package/lib/schemas/NumberSchema.js.map +1 -1
- package/lib/schemas/NumberSchema.mjs +9 -5
- package/lib/schemas/ObjectSchema.d.mts +20 -1
- package/lib/schemas/ObjectSchema.d.ts +20 -1
- package/lib/schemas/ObjectSchema.js +5 -5
- package/lib/schemas/ObjectSchema.mjs +4 -4
- package/lib/schemas/StringSchema.d.mts +13 -1
- package/lib/schemas/StringSchema.d.ts +13 -1
- package/lib/schemas/StringSchema.js +10 -6
- package/lib/schemas/StringSchema.js.map +1 -1
- package/lib/schemas/StringSchema.mjs +9 -5
- package/lib/translationMap.d.mts +12 -0
- package/lib/translationMap.d.ts +12 -0
- package/lib/translationMap.js +14 -0
- package/lib/translationMap.js.map +1 -0
- package/lib/translationMap.mjs +14 -0
- package/lib/translationMap.mjs.map +1 -0
- package/package.json +23 -6
- package/lib/asserts/common/equalTo.d.mts +0 -29
- package/lib/asserts/common/equalTo.d.ts +0 -29
- package/lib/asserts/common/equalTo.js +0 -8
- package/lib/asserts/common/equalTo.js.map +0 -1
- package/lib/asserts/common/equalTo.mjs +0 -8
- package/lib/asserts/common/index.js +0 -10
- package/lib/asserts/common/index.js.map +0 -1
- package/lib/asserts/common/index.mjs +0 -10
- package/lib/chunk-2AP4OQMT.js +0 -26
- package/lib/chunk-2AP4OQMT.js.map +0 -1
- package/lib/chunk-5NCJN6D2.js +0 -70
- package/lib/chunk-5NCJN6D2.js.map +0 -1
- package/lib/chunk-5ZMICHV3.js +0 -21
- package/lib/chunk-5ZMICHV3.js.map +0 -1
- package/lib/chunk-63IQFNFO.mjs +0 -27
- package/lib/chunk-63IQFNFO.mjs.map +0 -1
- package/lib/chunk-A3UTB4RE.mjs.map +0 -1
- package/lib/chunk-AJ4WV5DG.mjs.map +0 -1
- package/lib/chunk-APTTIN2L.js.map +0 -1
- package/lib/chunk-AXOP6HPJ.js +0 -14
- package/lib/chunk-AXOP6HPJ.js.map +0 -1
- package/lib/chunk-FCFO5J5Y.mjs +0 -14
- package/lib/chunk-FCFO5J5Y.mjs.map +0 -1
- package/lib/chunk-GEZME6V2.mjs.map +0 -1
- package/lib/chunk-GNBSKTFV.js +0 -27
- package/lib/chunk-GNBSKTFV.js.map +0 -1
- package/lib/chunk-IQ3QYABE.js +0 -32
- package/lib/chunk-IQ3QYABE.js.map +0 -1
- package/lib/chunk-L7HUXYFV.mjs.map +0 -1
- package/lib/chunk-LHTJHMKJ.mjs +0 -27
- package/lib/chunk-LHTJHMKJ.mjs.map +0 -1
- package/lib/chunk-NOADI6PO.mjs +0 -21
- package/lib/chunk-NOADI6PO.mjs.map +0 -1
- package/lib/chunk-NWY33MFU.js +0 -13
- package/lib/chunk-NWY33MFU.js.map +0 -1
- package/lib/chunk-P3Y6IWFA.mjs +0 -70
- package/lib/chunk-P3Y6IWFA.mjs.map +0 -1
- package/lib/chunk-PDVXBE27.js +0 -27
- package/lib/chunk-PDVXBE27.js.map +0 -1
- package/lib/chunk-QJOXKH7A.mjs +0 -26
- package/lib/chunk-QJOXKH7A.mjs.map +0 -1
- package/lib/chunk-QYLH5ZAC.mjs.map +0 -1
- package/lib/chunk-VPFIIM2X.js.map +0 -1
- package/lib/chunk-YXHH5BF6.js +0 -28
- package/lib/chunk-YXHH5BF6.js.map +0 -1
- package/lib/core.d.mts +0 -1
- package/lib/core.d.ts +0 -1
- package/lib/core.js +0 -10
- package/lib/core.js.map +0 -1
- package/lib/core.mjs +0 -10
- package/lib/parseSchema.js +0 -9
- package/lib/parseSchema.js.map +0 -1
- package/lib/parseSchema.mjs +0 -9
- /package/lib/asserts/{common → mix}/equalTo.mjs.map +0 -0
- /package/lib/asserts/{common → mix}/index.mjs.map +0 -0
- /package/lib/{core.mjs.map → asserts/mix/oneOfValues.mjs.map} +0 -0
- /package/lib/{parseSchema.mjs.map → commonTypes.mjs.map} +0 -0
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import {
|
|
2
|
+
setToDefaultLocale
|
|
3
|
+
} from "../../chunk-3HTYHE2X.mjs";
|
|
4
|
+
import {
|
|
5
|
+
guardException
|
|
6
|
+
} from "../../chunk-7XFLH6R2.mjs";
|
|
7
|
+
|
|
8
|
+
// src/asserts/string/lowerCase.ts
|
|
9
|
+
var lowerCaseErrorMessage = "The received value is not in lowercase";
|
|
10
|
+
var lowerCaseErrorKey = "s:lowerCase";
|
|
11
|
+
var lowerCase = () => (received, ctx) => {
|
|
12
|
+
if (received !== received.toLowerCase()) guardException("lower case", received, ctx, lowerCaseErrorKey);
|
|
13
|
+
};
|
|
14
|
+
lowerCase.key = lowerCaseErrorKey;
|
|
15
|
+
lowerCase.message = lowerCaseErrorMessage;
|
|
16
|
+
setToDefaultLocale(lowerCase);
|
|
17
|
+
export {
|
|
18
|
+
lowerCase
|
|
19
|
+
};
|
|
20
|
+
//# sourceMappingURL=lowerCase.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/asserts/string/lowerCase.ts"],"sourcesContent":["import { ExceptionContext, RequiredValidation } from '../../commonTypes';\nimport { guardException } from '../../exceptions';\nimport { setToDefaultLocale } from '../../translationMap';\n\nconst lowerCaseErrorMessage = 'The received value is not in lowercase';\nconst lowerCaseErrorKey = 's:lowerCase';\n\n/**\n * @description Asserts that a string value is in lowercase.\n * @returns {RequiredValidation} A validation function that takes a received string and an exception context.\n * @throws {ValidationError} if the received value is not in lowercase.\n * @example\n * const schema = string().custom(lowerCase());\n * parseOrFail(schema, 'valid'); // Valid\n * parseOrFail(schema, 'Invalid'); // Throws an error: 'The received value is not in lowercase'\n *\n * @translation Error Translation Key = 's:lowerCase'\n */\nexport const lowerCase = (): RequiredValidation => (received: string, ctx: ExceptionContext) => {\n if (received !== received.toLowerCase()) guardException('lower case', received, ctx, lowerCaseErrorKey);\n};\n\nlowerCase.key = lowerCaseErrorKey;\nlowerCase.message = lowerCaseErrorMessage;\nsetToDefaultLocale(lowerCase);\n"],"mappings":";;;;;;;;AAIA,IAAM,wBAAwB;AAC9B,IAAM,oBAAoB;AAanB,IAAM,YAAY,MAA0B,CAAC,UAAkB,QAA0B;AAC9F,MAAI,aAAa,SAAS,YAAY,EAAG,gBAAe,cAAc,UAAU,KAAK,iBAAiB;AACxG;AAEA,UAAU,MAAM;AAChB,UAAU,UAAU;AACpB,mBAAmB,SAAS;","names":[]}
|
|
@@ -1,16 +1,21 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { RequiredValidation } from '../../commonTypes.mjs';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* Asserts that the length of a string value is not greater than a specified maximum length.
|
|
5
|
-
*
|
|
6
|
-
* @
|
|
7
|
-
* @
|
|
8
|
-
*
|
|
4
|
+
* @description Asserts that the length of a string value is not greater than a specified maximum length.
|
|
5
|
+
* @param {number} expected The maximum allowed length for the string.
|
|
6
|
+
* @returns {RequiredValidation} A validation function that takes a received string and an exception context.
|
|
7
|
+
* @throws {ValidationError} if the length of the received value is greater than the expected length.
|
|
9
8
|
* @example
|
|
10
9
|
* const schema = string().custom(maxLength(10));
|
|
11
|
-
*
|
|
12
|
-
*
|
|
10
|
+
* parseOrFail(schema, 'short'); // Valid
|
|
11
|
+
* parseOrFail(schema, 'this is a very long string'); // Throws an error: 'The received value length is greater than expected'
|
|
12
|
+
*
|
|
13
|
+
* @translation Error Translation Key = 's:maxLength'
|
|
13
14
|
*/
|
|
14
|
-
declare const maxLength:
|
|
15
|
+
declare const maxLength: {
|
|
16
|
+
(expected: number): RequiredValidation;
|
|
17
|
+
key: string;
|
|
18
|
+
message: string;
|
|
19
|
+
};
|
|
15
20
|
|
|
16
21
|
export { maxLength };
|
|
@@ -1,16 +1,21 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { RequiredValidation } from '../../commonTypes.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* Asserts that the length of a string value is not greater than a specified maximum length.
|
|
5
|
-
*
|
|
6
|
-
* @
|
|
7
|
-
* @
|
|
8
|
-
*
|
|
4
|
+
* @description Asserts that the length of a string value is not greater than a specified maximum length.
|
|
5
|
+
* @param {number} expected The maximum allowed length for the string.
|
|
6
|
+
* @returns {RequiredValidation} A validation function that takes a received string and an exception context.
|
|
7
|
+
* @throws {ValidationError} if the length of the received value is greater than the expected length.
|
|
9
8
|
* @example
|
|
10
9
|
* const schema = string().custom(maxLength(10));
|
|
11
|
-
*
|
|
12
|
-
*
|
|
10
|
+
* parseOrFail(schema, 'short'); // Valid
|
|
11
|
+
* parseOrFail(schema, 'this is a very long string'); // Throws an error: 'The received value length is greater than expected'
|
|
12
|
+
*
|
|
13
|
+
* @translation Error Translation Key = 's:maxLength'
|
|
13
14
|
*/
|
|
14
|
-
declare const maxLength:
|
|
15
|
+
declare const maxLength: {
|
|
16
|
+
(expected: number): RequiredValidation;
|
|
17
|
+
key: string;
|
|
18
|
+
message: string;
|
|
19
|
+
};
|
|
15
20
|
|
|
16
21
|
export { maxLength };
|
|
@@ -1,12 +1,19 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunk5BVJ6YMHjs = require('../../chunk-5BVJ6YMH.js');
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
var _chunkWK4O3HH4js = require('../../chunk-WK4O3HH4.js');
|
|
4
7
|
|
|
5
8
|
// src/asserts/string/maxLength.ts
|
|
6
|
-
var
|
|
7
|
-
|
|
8
|
-
|
|
9
|
+
var maxLengthErrorMessage = "The received value length is greater than expected";
|
|
10
|
+
var maxLengthErrorKey = "s:maxLength";
|
|
11
|
+
var maxLength = (expected) => (received, ctx) => {
|
|
12
|
+
if (received.length > expected) _chunkWK4O3HH4js.guardException.call(void 0, expected, received, ctx, maxLengthErrorMessage);
|
|
9
13
|
};
|
|
14
|
+
maxLength.key = maxLengthErrorKey;
|
|
15
|
+
maxLength.message = maxLengthErrorMessage;
|
|
16
|
+
_chunk5BVJ6YMHjs.setToDefaultLocale.call(void 0, maxLength);
|
|
10
17
|
|
|
11
18
|
|
|
12
19
|
exports.maxLength = maxLength;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/home/runner/work/bguard/bguard/lib/asserts/string/maxLength.js","../../../src/asserts/string/maxLength.ts"],"names":[],"mappings":"AAAA;AACE;AACF,0DAAgC;AAChC;AACA;
|
|
1
|
+
{"version":3,"sources":["/home/runner/work/bguard/bguard/lib/asserts/string/maxLength.js","../../../src/asserts/string/maxLength.ts"],"names":[],"mappings":"AAAA;AACE;AACF,0DAAgC;AAChC;AACE;AACF,0DAAgC;AAChC;AACA;ACHA,IAAM,sBAAA,EAAwB,oDAAA;AAC9B,IAAM,kBAAA,EAAoB,aAAA;AAcnB,IAAM,UAAA,EACX,CAAC,QAAA,EAAA,GACD,CAAC,QAAA,EAAkB,GAAA,EAAA,GAA0B;AAC3C,EAAA,GAAA,CAAI,QAAA,CAAS,OAAA,EAAS,QAAA,EAAU,6CAAA,QAAe,EAAU,QAAA,EAAU,GAAA,EAAK,qBAAqB,CAAA;AAC/F,CAAA;AAEF,SAAA,CAAU,IAAA,EAAM,iBAAA;AAChB,SAAA,CAAU,QAAA,EAAU,qBAAA;AACpB,iDAAA,SAA4B,CAAA;ADX5B;AACE;AACF,8BAAC","file":"/home/runner/work/bguard/bguard/lib/asserts/string/maxLength.js","sourcesContent":[null,"import { guardException } from '../../exceptions';\nimport { ExceptionContext, RequiredValidation } from '../../commonTypes';\nimport { setToDefaultLocale } from '../../translationMap';\n\nconst maxLengthErrorMessage = 'The received value length is greater than expected';\nconst maxLengthErrorKey = 's:maxLength';\n\n/**\n * @description Asserts that the length of a string value is not greater than a specified maximum length.\n * @param {number} expected The maximum allowed length for the string.\n * @returns {RequiredValidation} A validation function that takes a received string and an exception context.\n * @throws {ValidationError} if the length of the received value is greater than the expected length.\n * @example\n * const schema = string().custom(maxLength(10));\n * parseOrFail(schema, 'short'); // Valid\n * parseOrFail(schema, 'this is a very long string'); // Throws an error: 'The received value length is greater than expected'\n *\n * @translation Error Translation Key = 's:maxLength'\n */\nexport const maxLength =\n (expected: number): RequiredValidation =>\n (received: string, ctx: ExceptionContext) => {\n if (received.length > expected) guardException(expected, received, ctx, maxLengthErrorMessage);\n };\n\nmaxLength.key = maxLengthErrorKey;\nmaxLength.message = maxLengthErrorMessage;\nsetToDefaultLocale(maxLength);\n"]}
|
|
@@ -1,12 +1,19 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
} from "../../chunk-
|
|
2
|
+
setToDefaultLocale
|
|
3
|
+
} from "../../chunk-3HTYHE2X.mjs";
|
|
4
|
+
import {
|
|
5
|
+
guardException
|
|
6
|
+
} from "../../chunk-7XFLH6R2.mjs";
|
|
4
7
|
|
|
5
8
|
// src/asserts/string/maxLength.ts
|
|
6
|
-
var
|
|
7
|
-
|
|
8
|
-
|
|
9
|
+
var maxLengthErrorMessage = "The received value length is greater than expected";
|
|
10
|
+
var maxLengthErrorKey = "s:maxLength";
|
|
11
|
+
var maxLength = (expected) => (received, ctx) => {
|
|
12
|
+
if (received.length > expected) guardException(expected, received, ctx, maxLengthErrorMessage);
|
|
9
13
|
};
|
|
14
|
+
maxLength.key = maxLengthErrorKey;
|
|
15
|
+
maxLength.message = maxLengthErrorMessage;
|
|
16
|
+
setToDefaultLocale(maxLength);
|
|
10
17
|
export {
|
|
11
18
|
maxLength
|
|
12
19
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/asserts/string/maxLength.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"sources":["../../../src/asserts/string/maxLength.ts"],"sourcesContent":["import { guardException } from '../../exceptions';\nimport { ExceptionContext, RequiredValidation } from '../../commonTypes';\nimport { setToDefaultLocale } from '../../translationMap';\n\nconst maxLengthErrorMessage = 'The received value length is greater than expected';\nconst maxLengthErrorKey = 's:maxLength';\n\n/**\n * @description Asserts that the length of a string value is not greater than a specified maximum length.\n * @param {number} expected The maximum allowed length for the string.\n * @returns {RequiredValidation} A validation function that takes a received string and an exception context.\n * @throws {ValidationError} if the length of the received value is greater than the expected length.\n * @example\n * const schema = string().custom(maxLength(10));\n * parseOrFail(schema, 'short'); // Valid\n * parseOrFail(schema, 'this is a very long string'); // Throws an error: 'The received value length is greater than expected'\n *\n * @translation Error Translation Key = 's:maxLength'\n */\nexport const maxLength =\n (expected: number): RequiredValidation =>\n (received: string, ctx: ExceptionContext) => {\n if (received.length > expected) guardException(expected, received, ctx, maxLengthErrorMessage);\n };\n\nmaxLength.key = maxLengthErrorKey;\nmaxLength.message = maxLengthErrorMessage;\nsetToDefaultLocale(maxLength);\n"],"mappings":";;;;;;;;AAIA,IAAM,wBAAwB;AAC9B,IAAM,oBAAoB;AAcnB,IAAM,YACX,CAAC,aACD,CAAC,UAAkB,QAA0B;AAC3C,MAAI,SAAS,SAAS,SAAU,gBAAe,UAAU,UAAU,KAAK,qBAAqB;AAC/F;AAEF,UAAU,MAAM;AAChB,UAAU,UAAU;AACpB,mBAAmB,SAAS;","names":[]}
|
|
@@ -1,16 +1,21 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { RequiredValidation } from '../../commonTypes.mjs';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* Asserts that the length of a string value is not less than a specified minimum length.
|
|
5
|
-
*
|
|
6
|
-
* @
|
|
7
|
-
* @
|
|
8
|
-
*
|
|
4
|
+
* @description Asserts that the length of a string value is not less than a specified minimum length.
|
|
5
|
+
* @param {number} expected The minimum required length for the string.
|
|
6
|
+
* @returns {RequiredValidation} A validation function that takes a received string and an exception context.
|
|
7
|
+
* @throws {ValidationError} if the length of the received value is less than the expected length.
|
|
9
8
|
* @example
|
|
10
9
|
* const schema = string().custom(minLength(5));
|
|
11
|
-
*
|
|
12
|
-
*
|
|
10
|
+
* parseOrFail(schema, 'short'); // Throws an error: 'The received value length is less than expected'
|
|
11
|
+
* parseOrFail(schema, 'adequate'); // Valid
|
|
12
|
+
*
|
|
13
|
+
* @translation Error Translation Key = 's:minLength'
|
|
13
14
|
*/
|
|
14
|
-
declare const minLength:
|
|
15
|
+
declare const minLength: {
|
|
16
|
+
(expected: number): RequiredValidation;
|
|
17
|
+
key: string;
|
|
18
|
+
message: string;
|
|
19
|
+
};
|
|
15
20
|
|
|
16
21
|
export { minLength };
|
|
@@ -1,16 +1,21 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { RequiredValidation } from '../../commonTypes.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* Asserts that the length of a string value is not less than a specified minimum length.
|
|
5
|
-
*
|
|
6
|
-
* @
|
|
7
|
-
* @
|
|
8
|
-
*
|
|
4
|
+
* @description Asserts that the length of a string value is not less than a specified minimum length.
|
|
5
|
+
* @param {number} expected The minimum required length for the string.
|
|
6
|
+
* @returns {RequiredValidation} A validation function that takes a received string and an exception context.
|
|
7
|
+
* @throws {ValidationError} if the length of the received value is less than the expected length.
|
|
9
8
|
* @example
|
|
10
9
|
* const schema = string().custom(minLength(5));
|
|
11
|
-
*
|
|
12
|
-
*
|
|
10
|
+
* parseOrFail(schema, 'short'); // Throws an error: 'The received value length is less than expected'
|
|
11
|
+
* parseOrFail(schema, 'adequate'); // Valid
|
|
12
|
+
*
|
|
13
|
+
* @translation Error Translation Key = 's:minLength'
|
|
13
14
|
*/
|
|
14
|
-
declare const minLength:
|
|
15
|
+
declare const minLength: {
|
|
16
|
+
(expected: number): RequiredValidation;
|
|
17
|
+
key: string;
|
|
18
|
+
message: string;
|
|
19
|
+
};
|
|
15
20
|
|
|
16
21
|
export { minLength };
|
|
@@ -1,12 +1,19 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunk5BVJ6YMHjs = require('../../chunk-5BVJ6YMH.js');
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
var _chunkWK4O3HH4js = require('../../chunk-WK4O3HH4.js');
|
|
4
7
|
|
|
5
8
|
// src/asserts/string/minLength.ts
|
|
6
|
-
var
|
|
7
|
-
|
|
8
|
-
|
|
9
|
+
var minLengthErrorMessage = "The received value length is less than expected";
|
|
10
|
+
var minLengthErrorKey = "s:minLength";
|
|
11
|
+
var minLength = (expected) => (received, ctx) => {
|
|
12
|
+
if (received.length < expected) _chunkWK4O3HH4js.guardException.call(void 0, expected, received, ctx, minLengthErrorMessage);
|
|
9
13
|
};
|
|
14
|
+
minLength.key = minLengthErrorKey;
|
|
15
|
+
minLength.message = minLengthErrorMessage;
|
|
16
|
+
_chunk5BVJ6YMHjs.setToDefaultLocale.call(void 0, minLength);
|
|
10
17
|
|
|
11
18
|
|
|
12
19
|
exports.minLength = minLength;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/home/runner/work/bguard/bguard/lib/asserts/string/minLength.js","../../../src/asserts/string/minLength.ts"],"names":[],"mappings":"AAAA;AACE;AACF,0DAAgC;AAChC;AACA;
|
|
1
|
+
{"version":3,"sources":["/home/runner/work/bguard/bguard/lib/asserts/string/minLength.js","../../../src/asserts/string/minLength.ts"],"names":[],"mappings":"AAAA;AACE;AACF,0DAAgC;AAChC;AACE;AACF,0DAAgC;AAChC;AACA;ACHA,IAAM,sBAAA,EAAwB,iDAAA;AAC9B,IAAM,kBAAA,EAAoB,aAAA;AAcnB,IAAM,UAAA,EACX,CAAC,QAAA,EAAA,GACD,CAAC,QAAA,EAAkB,GAAA,EAAA,GAA0B;AAC3C,EAAA,GAAA,CAAI,QAAA,CAAS,OAAA,EAAS,QAAA,EAAU,6CAAA,QAAe,EAAU,QAAA,EAAU,GAAA,EAAK,qBAAqB,CAAA;AAC/F,CAAA;AAEF,SAAA,CAAU,IAAA,EAAM,iBAAA;AAChB,SAAA,CAAU,QAAA,EAAU,qBAAA;AACpB,iDAAA,SAA4B,CAAA;ADX5B;AACE;AACF,8BAAC","file":"/home/runner/work/bguard/bguard/lib/asserts/string/minLength.js","sourcesContent":[null,"import { guardException } from '../../exceptions';\nimport { ExceptionContext, RequiredValidation } from '../../commonTypes';\nimport { setToDefaultLocale } from '../../translationMap';\n\nconst minLengthErrorMessage = 'The received value length is less than expected';\nconst minLengthErrorKey = 's:minLength';\n\n/**\n * @description Asserts that the length of a string value is not less than a specified minimum length.\n * @param {number} expected The minimum required length for the string.\n * @returns {RequiredValidation} A validation function that takes a received string and an exception context.\n * @throws {ValidationError} if the length of the received value is less than the expected length.\n * @example\n * const schema = string().custom(minLength(5));\n * parseOrFail(schema, 'short'); // Throws an error: 'The received value length is less than expected'\n * parseOrFail(schema, 'adequate'); // Valid\n *\n * @translation Error Translation Key = 's:minLength'\n */\nexport const minLength =\n (expected: number): RequiredValidation =>\n (received: string, ctx: ExceptionContext) => {\n if (received.length < expected) guardException(expected, received, ctx, minLengthErrorMessage);\n };\n\nminLength.key = minLengthErrorKey;\nminLength.message = minLengthErrorMessage;\nsetToDefaultLocale(minLength);\n"]}
|
|
@@ -1,12 +1,19 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
} from "../../chunk-
|
|
2
|
+
setToDefaultLocale
|
|
3
|
+
} from "../../chunk-3HTYHE2X.mjs";
|
|
4
|
+
import {
|
|
5
|
+
guardException
|
|
6
|
+
} from "../../chunk-7XFLH6R2.mjs";
|
|
4
7
|
|
|
5
8
|
// src/asserts/string/minLength.ts
|
|
6
|
-
var
|
|
7
|
-
|
|
8
|
-
|
|
9
|
+
var minLengthErrorMessage = "The received value length is less than expected";
|
|
10
|
+
var minLengthErrorKey = "s:minLength";
|
|
11
|
+
var minLength = (expected) => (received, ctx) => {
|
|
12
|
+
if (received.length < expected) guardException(expected, received, ctx, minLengthErrorMessage);
|
|
9
13
|
};
|
|
14
|
+
minLength.key = minLengthErrorKey;
|
|
15
|
+
minLength.message = minLengthErrorMessage;
|
|
16
|
+
setToDefaultLocale(minLength);
|
|
10
17
|
export {
|
|
11
18
|
minLength
|
|
12
19
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/asserts/string/minLength.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"sources":["../../../src/asserts/string/minLength.ts"],"sourcesContent":["import { guardException } from '../../exceptions';\nimport { ExceptionContext, RequiredValidation } from '../../commonTypes';\nimport { setToDefaultLocale } from '../../translationMap';\n\nconst minLengthErrorMessage = 'The received value length is less than expected';\nconst minLengthErrorKey = 's:minLength';\n\n/**\n * @description Asserts that the length of a string value is not less than a specified minimum length.\n * @param {number} expected The minimum required length for the string.\n * @returns {RequiredValidation} A validation function that takes a received string and an exception context.\n * @throws {ValidationError} if the length of the received value is less than the expected length.\n * @example\n * const schema = string().custom(minLength(5));\n * parseOrFail(schema, 'short'); // Throws an error: 'The received value length is less than expected'\n * parseOrFail(schema, 'adequate'); // Valid\n *\n * @translation Error Translation Key = 's:minLength'\n */\nexport const minLength =\n (expected: number): RequiredValidation =>\n (received: string, ctx: ExceptionContext) => {\n if (received.length < expected) guardException(expected, received, ctx, minLengthErrorMessage);\n };\n\nminLength.key = minLengthErrorKey;\nminLength.message = minLengthErrorMessage;\nsetToDefaultLocale(minLength);\n"],"mappings":";;;;;;;;AAIA,IAAM,wBAAwB;AAC9B,IAAM,oBAAoB;AAcnB,IAAM,YACX,CAAC,aACD,CAAC,UAAkB,QAA0B;AAC3C,MAAI,SAAS,SAAS,SAAU,gBAAe,UAAU,UAAU,KAAK,qBAAqB;AAC/F;AAEF,UAAU,MAAM;AAChB,UAAU,UAAU;AACpB,mBAAmB,SAAS;","names":[]}
|
|
@@ -1,16 +1,21 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { RequiredValidation } from '../../commonTypes.mjs';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* Asserts that a string value matches a specified regular expression pattern.
|
|
5
|
-
*
|
|
6
|
-
* @
|
|
7
|
-
* @
|
|
8
|
-
*
|
|
4
|
+
* @description Asserts that a string value matches a specified regular expression pattern.
|
|
5
|
+
* @param {RegExp} expected The regular expression pattern that the string value should match.
|
|
6
|
+
* @returns {RequiredValidation} A validation function that takes a received string and an exception context.
|
|
7
|
+
* @throws {ValidationError} if the received value does not match the expected pattern.
|
|
9
8
|
* @example
|
|
10
9
|
* const schema = string().custom(regExp(/^[A-Za-z0-9]+$/)); // Validates against alphanumeric pattern
|
|
11
|
-
*
|
|
12
|
-
*
|
|
10
|
+
* parseOrFail(schema, 'valid123'); // Valid
|
|
11
|
+
* parseOrFail(schema, 'invalid!@#'); // Throws an error: 'The received value does not match the required text pattern'
|
|
12
|
+
*
|
|
13
|
+
* @translation Error Translation Key = 's:regExp'
|
|
13
14
|
*/
|
|
14
|
-
declare const regExp:
|
|
15
|
+
declare const regExp: {
|
|
16
|
+
(expected: RegExp): RequiredValidation;
|
|
17
|
+
key: string;
|
|
18
|
+
message: string;
|
|
19
|
+
};
|
|
15
20
|
|
|
16
21
|
export { regExp };
|
|
@@ -1,16 +1,21 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { RequiredValidation } from '../../commonTypes.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* Asserts that a string value matches a specified regular expression pattern.
|
|
5
|
-
*
|
|
6
|
-
* @
|
|
7
|
-
* @
|
|
8
|
-
*
|
|
4
|
+
* @description Asserts that a string value matches a specified regular expression pattern.
|
|
5
|
+
* @param {RegExp} expected The regular expression pattern that the string value should match.
|
|
6
|
+
* @returns {RequiredValidation} A validation function that takes a received string and an exception context.
|
|
7
|
+
* @throws {ValidationError} if the received value does not match the expected pattern.
|
|
9
8
|
* @example
|
|
10
9
|
* const schema = string().custom(regExp(/^[A-Za-z0-9]+$/)); // Validates against alphanumeric pattern
|
|
11
|
-
*
|
|
12
|
-
*
|
|
10
|
+
* parseOrFail(schema, 'valid123'); // Valid
|
|
11
|
+
* parseOrFail(schema, 'invalid!@#'); // Throws an error: 'The received value does not match the required text pattern'
|
|
12
|
+
*
|
|
13
|
+
* @translation Error Translation Key = 's:regExp'
|
|
13
14
|
*/
|
|
14
|
-
declare const regExp:
|
|
15
|
+
declare const regExp: {
|
|
16
|
+
(expected: RegExp): RequiredValidation;
|
|
17
|
+
key: string;
|
|
18
|
+
message: string;
|
|
19
|
+
};
|
|
15
20
|
|
|
16
21
|
export { regExp };
|
|
@@ -1,12 +1,19 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunk5BVJ6YMHjs = require('../../chunk-5BVJ6YMH.js');
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
var _chunkWK4O3HH4js = require('../../chunk-WK4O3HH4.js');
|
|
4
7
|
|
|
5
8
|
// src/asserts/string/regExp.ts
|
|
6
|
-
var
|
|
7
|
-
|
|
8
|
-
|
|
9
|
+
var regExpErrorMessage = "The received value does not match the required text pattern";
|
|
10
|
+
var regExpErrorKey = "s:regExp";
|
|
11
|
+
var regExp = (expected) => (received, ctx) => {
|
|
12
|
+
if (!expected.test(received)) _chunkWK4O3HH4js.guardException.call(void 0, expected, received, ctx, regExpErrorMessage);
|
|
9
13
|
};
|
|
14
|
+
regExp.key = regExpErrorKey;
|
|
15
|
+
regExp.message = regExpErrorMessage;
|
|
16
|
+
_chunk5BVJ6YMHjs.setToDefaultLocale.call(void 0, regExp);
|
|
10
17
|
|
|
11
18
|
|
|
12
19
|
exports.regExp = regExp;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/home/runner/work/bguard/bguard/lib/asserts/string/regExp.js","../../../src/asserts/string/regExp.ts"],"names":[],"mappings":"AAAA;AACE;AACF,0DAAgC;AAChC;AACA;
|
|
1
|
+
{"version":3,"sources":["/home/runner/work/bguard/bguard/lib/asserts/string/regExp.js","../../../src/asserts/string/regExp.ts"],"names":[],"mappings":"AAAA;AACE;AACF,0DAAgC;AAChC;AACE;AACF,0DAAgC;AAChC;AACA;ACHA,IAAM,mBAAA,EAAqB,6DAAA;AAC3B,IAAM,eAAA,EAAiB,UAAA;AAchB,IAAM,OAAA,EACX,CAAC,QAAA,EAAA,GACD,CAAC,QAAA,EAAkB,GAAA,EAAA,GAA0B;AAC3C,EAAA,GAAA,CAAI,CAAC,QAAA,CAAS,IAAA,CAAK,QAAQ,CAAA,EAAG,6CAAA,QAAe,EAAU,QAAA,EAAU,GAAA,EAAK,kBAAkB,CAAA;AAC1F,CAAA;AAEF,MAAA,CAAO,IAAA,EAAM,cAAA;AACb,MAAA,CAAO,QAAA,EAAU,kBAAA;AACjB,iDAAA,MAAyB,CAAA;ADXzB;AACE;AACF,wBAAC","file":"/home/runner/work/bguard/bguard/lib/asserts/string/regExp.js","sourcesContent":[null,"import { ExceptionContext, RequiredValidation } from '../../commonTypes';\nimport { guardException } from '../../exceptions';\nimport { setToDefaultLocale } from '../../translationMap';\n\nconst regExpErrorMessage = 'The received value does not match the required text pattern';\nconst regExpErrorKey = 's:regExp';\n\n/**\n * @description Asserts that a string value matches a specified regular expression pattern.\n * @param {RegExp} expected The regular expression pattern that the string value should match.\n * @returns {RequiredValidation} A validation function that takes a received string and an exception context.\n * @throws {ValidationError} if the received value does not match the expected pattern.\n * @example\n * const schema = string().custom(regExp(/^[A-Za-z0-9]+$/)); // Validates against alphanumeric pattern\n * parseOrFail(schema, 'valid123'); // Valid\n * parseOrFail(schema, 'invalid!@#'); // Throws an error: 'The received value does not match the required text pattern'\n *\n * @translation Error Translation Key = 's:regExp'\n */\nexport const regExp =\n (expected: RegExp): RequiredValidation =>\n (received: string, ctx: ExceptionContext) => {\n if (!expected.test(received)) guardException(expected, received, ctx, regExpErrorMessage);\n };\n\nregExp.key = regExpErrorKey;\nregExp.message = regExpErrorMessage;\nsetToDefaultLocale(regExp);\n"]}
|
|
@@ -1,12 +1,19 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
} from "../../chunk-
|
|
2
|
+
setToDefaultLocale
|
|
3
|
+
} from "../../chunk-3HTYHE2X.mjs";
|
|
4
|
+
import {
|
|
5
|
+
guardException
|
|
6
|
+
} from "../../chunk-7XFLH6R2.mjs";
|
|
4
7
|
|
|
5
8
|
// src/asserts/string/regExp.ts
|
|
6
|
-
var
|
|
7
|
-
|
|
8
|
-
|
|
9
|
+
var regExpErrorMessage = "The received value does not match the required text pattern";
|
|
10
|
+
var regExpErrorKey = "s:regExp";
|
|
11
|
+
var regExp = (expected) => (received, ctx) => {
|
|
12
|
+
if (!expected.test(received)) guardException(expected, received, ctx, regExpErrorMessage);
|
|
9
13
|
};
|
|
14
|
+
regExp.key = regExpErrorKey;
|
|
15
|
+
regExp.message = regExpErrorMessage;
|
|
16
|
+
setToDefaultLocale(regExp);
|
|
10
17
|
export {
|
|
11
18
|
regExp
|
|
12
19
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/asserts/string/regExp.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"sources":["../../../src/asserts/string/regExp.ts"],"sourcesContent":["import { ExceptionContext, RequiredValidation } from '../../commonTypes';\nimport { guardException } from '../../exceptions';\nimport { setToDefaultLocale } from '../../translationMap';\n\nconst regExpErrorMessage = 'The received value does not match the required text pattern';\nconst regExpErrorKey = 's:regExp';\n\n/**\n * @description Asserts that a string value matches a specified regular expression pattern.\n * @param {RegExp} expected The regular expression pattern that the string value should match.\n * @returns {RequiredValidation} A validation function that takes a received string and an exception context.\n * @throws {ValidationError} if the received value does not match the expected pattern.\n * @example\n * const schema = string().custom(regExp(/^[A-Za-z0-9]+$/)); // Validates against alphanumeric pattern\n * parseOrFail(schema, 'valid123'); // Valid\n * parseOrFail(schema, 'invalid!@#'); // Throws an error: 'The received value does not match the required text pattern'\n *\n * @translation Error Translation Key = 's:regExp'\n */\nexport const regExp =\n (expected: RegExp): RequiredValidation =>\n (received: string, ctx: ExceptionContext) => {\n if (!expected.test(received)) guardException(expected, received, ctx, regExpErrorMessage);\n };\n\nregExp.key = regExpErrorKey;\nregExp.message = regExpErrorMessage;\nsetToDefaultLocale(regExp);\n"],"mappings":";;;;;;;;AAIA,IAAM,qBAAqB;AAC3B,IAAM,iBAAiB;AAchB,IAAM,SACX,CAAC,aACD,CAAC,UAAkB,QAA0B;AAC3C,MAAI,CAAC,SAAS,KAAK,QAAQ,EAAG,gBAAe,UAAU,UAAU,KAAK,kBAAkB;AAC1F;AAEF,OAAO,MAAM;AACb,OAAO,UAAU;AACjB,mBAAmB,MAAM;","names":[]}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { RequiredValidation } from '../../commonTypes.mjs';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @description Asserts that a string value starts with a specified substring.
|
|
5
|
+
* @param {string} substring The substring that the string value must start with.
|
|
6
|
+
* @returns {RequiredValidation} A validation function that takes a received string and an exception context.
|
|
7
|
+
* @throws {ValidationError} if the received value does not start with the required substring.
|
|
8
|
+
* @example
|
|
9
|
+
* const schema = string().custom(startsWith('foo'));
|
|
10
|
+
* parseOrFail(schema, 'foobar'); // Valid
|
|
11
|
+
* parseOrFail(schema, 'barfoo'); // Throws an error: 'The received value does not start with the required substring'
|
|
12
|
+
*
|
|
13
|
+
* @translation Error Translation Key = 's:startsWith'
|
|
14
|
+
*/
|
|
15
|
+
declare const startsWith: {
|
|
16
|
+
(substring: string): RequiredValidation;
|
|
17
|
+
key: string;
|
|
18
|
+
message: string;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export { startsWith };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { RequiredValidation } from '../../commonTypes.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @description Asserts that a string value starts with a specified substring.
|
|
5
|
+
* @param {string} substring The substring that the string value must start with.
|
|
6
|
+
* @returns {RequiredValidation} A validation function that takes a received string and an exception context.
|
|
7
|
+
* @throws {ValidationError} if the received value does not start with the required substring.
|
|
8
|
+
* @example
|
|
9
|
+
* const schema = string().custom(startsWith('foo'));
|
|
10
|
+
* parseOrFail(schema, 'foobar'); // Valid
|
|
11
|
+
* parseOrFail(schema, 'barfoo'); // Throws an error: 'The received value does not start with the required substring'
|
|
12
|
+
*
|
|
13
|
+
* @translation Error Translation Key = 's:startsWith'
|
|
14
|
+
*/
|
|
15
|
+
declare const startsWith: {
|
|
16
|
+
(substring: string): RequiredValidation;
|
|
17
|
+
key: string;
|
|
18
|
+
message: string;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export { startsWith };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
+
|
|
3
|
+
var _chunk5BVJ6YMHjs = require('../../chunk-5BVJ6YMH.js');
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
var _chunkWK4O3HH4js = require('../../chunk-WK4O3HH4.js');
|
|
7
|
+
|
|
8
|
+
// src/asserts/string/startsWith.ts
|
|
9
|
+
var startsWithErrorMessage = "The received value does not start with the required substring";
|
|
10
|
+
var startsWithErrorKey = "s:startsWith";
|
|
11
|
+
var startsWith = (substring) => (received, ctx) => {
|
|
12
|
+
if (!received.startsWith(substring)) {
|
|
13
|
+
_chunkWK4O3HH4js.guardException.call(void 0, `starts with '${substring}'`, received, ctx, startsWithErrorKey);
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
startsWith.key = startsWithErrorKey;
|
|
17
|
+
startsWith.message = startsWithErrorMessage;
|
|
18
|
+
_chunk5BVJ6YMHjs.setToDefaultLocale.call(void 0, startsWith);
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
exports.startsWith = startsWith;
|
|
22
|
+
//# sourceMappingURL=startsWith.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/home/runner/work/bguard/bguard/lib/asserts/string/startsWith.js","../../../src/asserts/string/startsWith.ts"],"names":[],"mappings":"AAAA;AACE;AACF,0DAAgC;AAChC;AACE;AACF,0DAAgC;AAChC;AACA;ACHA,IAAM,uBAAA,EAAyB,+DAAA;AAC/B,IAAM,mBAAA,EAAqB,cAAA;AAcpB,IAAM,WAAA,EACX,CAAC,SAAA,EAAA,GACD,CAAC,QAAA,EAAkB,GAAA,EAAA,GAA0B;AAC3C,EAAA,GAAA,CAAI,CAAC,QAAA,CAAS,UAAA,CAAW,SAAS,CAAA,EAAG;AACnC,IAAA,6CAAA,CAAe,aAAA,EAAgB,SAAS,CAAA,CAAA,CAAA,EAAK,QAAA,EAAU,GAAA,EAAK,kBAAkB,CAAA;AAAA,EAChF;AACF,CAAA;AAEF,UAAA,CAAW,IAAA,EAAM,kBAAA;AACjB,UAAA,CAAW,QAAA,EAAU,sBAAA;AACrB,iDAAA,UAA6B,CAAA;ADX7B;AACE;AACF,gCAAC","file":"/home/runner/work/bguard/bguard/lib/asserts/string/startsWith.js","sourcesContent":[null,"import { guardException } from '../../exceptions';\nimport { ExceptionContext, RequiredValidation } from '../../commonTypes';\nimport { setToDefaultLocale } from '../../translationMap';\n\nconst startsWithErrorMessage = 'The received value does not start with the required substring';\nconst startsWithErrorKey = 's:startsWith';\n\n/**\n * @description Asserts that a string value starts with a specified substring.\n * @param {string} substring The substring that the string value must start with.\n * @returns {RequiredValidation} A validation function that takes a received string and an exception context.\n * @throws {ValidationError} if the received value does not start with the required substring.\n * @example\n * const schema = string().custom(startsWith('foo'));\n * parseOrFail(schema, 'foobar'); // Valid\n * parseOrFail(schema, 'barfoo'); // Throws an error: 'The received value does not start with the required substring'\n *\n * @translation Error Translation Key = 's:startsWith'\n */\nexport const startsWith =\n (substring: string): RequiredValidation =>\n (received: string, ctx: ExceptionContext) => {\n if (!received.startsWith(substring)) {\n guardException(`starts with '${substring}'`, received, ctx, startsWithErrorKey);\n }\n };\n\nstartsWith.key = startsWithErrorKey;\nstartsWith.message = startsWithErrorMessage;\nsetToDefaultLocale(startsWith);\n"]}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import {
|
|
2
|
+
setToDefaultLocale
|
|
3
|
+
} from "../../chunk-3HTYHE2X.mjs";
|
|
4
|
+
import {
|
|
5
|
+
guardException
|
|
6
|
+
} from "../../chunk-7XFLH6R2.mjs";
|
|
7
|
+
|
|
8
|
+
// src/asserts/string/startsWith.ts
|
|
9
|
+
var startsWithErrorMessage = "The received value does not start with the required substring";
|
|
10
|
+
var startsWithErrorKey = "s:startsWith";
|
|
11
|
+
var startsWith = (substring) => (received, ctx) => {
|
|
12
|
+
if (!received.startsWith(substring)) {
|
|
13
|
+
guardException(`starts with '${substring}'`, received, ctx, startsWithErrorKey);
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
startsWith.key = startsWithErrorKey;
|
|
17
|
+
startsWith.message = startsWithErrorMessage;
|
|
18
|
+
setToDefaultLocale(startsWith);
|
|
19
|
+
export {
|
|
20
|
+
startsWith
|
|
21
|
+
};
|
|
22
|
+
//# sourceMappingURL=startsWith.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/asserts/string/startsWith.ts"],"sourcesContent":["import { guardException } from '../../exceptions';\nimport { ExceptionContext, RequiredValidation } from '../../commonTypes';\nimport { setToDefaultLocale } from '../../translationMap';\n\nconst startsWithErrorMessage = 'The received value does not start with the required substring';\nconst startsWithErrorKey = 's:startsWith';\n\n/**\n * @description Asserts that a string value starts with a specified substring.\n * @param {string} substring The substring that the string value must start with.\n * @returns {RequiredValidation} A validation function that takes a received string and an exception context.\n * @throws {ValidationError} if the received value does not start with the required substring.\n * @example\n * const schema = string().custom(startsWith('foo'));\n * parseOrFail(schema, 'foobar'); // Valid\n * parseOrFail(schema, 'barfoo'); // Throws an error: 'The received value does not start with the required substring'\n *\n * @translation Error Translation Key = 's:startsWith'\n */\nexport const startsWith =\n (substring: string): RequiredValidation =>\n (received: string, ctx: ExceptionContext) => {\n if (!received.startsWith(substring)) {\n guardException(`starts with '${substring}'`, received, ctx, startsWithErrorKey);\n }\n };\n\nstartsWith.key = startsWithErrorKey;\nstartsWith.message = startsWithErrorMessage;\nsetToDefaultLocale(startsWith);\n"],"mappings":";;;;;;;;AAIA,IAAM,yBAAyB;AAC/B,IAAM,qBAAqB;AAcpB,IAAM,aACX,CAAC,cACD,CAAC,UAAkB,QAA0B;AAC3C,MAAI,CAAC,SAAS,WAAW,SAAS,GAAG;AACnC,mBAAe,gBAAgB,SAAS,KAAK,UAAU,KAAK,kBAAkB;AAAA,EAChF;AACF;AAEF,WAAW,MAAM;AACjB,WAAW,UAAU;AACrB,mBAAmB,UAAU;","names":[]}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { RequiredValidation } from '../../commonTypes.mjs';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @description Asserts that a string value is entirely in uppercase.
|
|
5
|
+
* @returns {RequiredValidation} A validation function that takes a received string and an exception context.
|
|
6
|
+
* @throws {ValidationError} if the received value is not in uppercase.
|
|
7
|
+
* @example
|
|
8
|
+
* const schema = string().custom(upperCase());
|
|
9
|
+
* parseOrFail(schema, 'VALID'); // Valid
|
|
10
|
+
* parseOrFail(schema, 'INVALID'); // Throws an error: 'The received value is not in uppercase'
|
|
11
|
+
* parseOrFail(schema, 'Valid'); // Throws an error: 'The received value is not in uppercase'
|
|
12
|
+
*
|
|
13
|
+
* @translation Error Translation Key = 's:upperCase'
|
|
14
|
+
*/
|
|
15
|
+
declare const upperCase: {
|
|
16
|
+
(): RequiredValidation;
|
|
17
|
+
key: string;
|
|
18
|
+
message: string;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export { upperCase };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { RequiredValidation } from '../../commonTypes.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @description Asserts that a string value is entirely in uppercase.
|
|
5
|
+
* @returns {RequiredValidation} A validation function that takes a received string and an exception context.
|
|
6
|
+
* @throws {ValidationError} if the received value is not in uppercase.
|
|
7
|
+
* @example
|
|
8
|
+
* const schema = string().custom(upperCase());
|
|
9
|
+
* parseOrFail(schema, 'VALID'); // Valid
|
|
10
|
+
* parseOrFail(schema, 'INVALID'); // Throws an error: 'The received value is not in uppercase'
|
|
11
|
+
* parseOrFail(schema, 'Valid'); // Throws an error: 'The received value is not in uppercase'
|
|
12
|
+
*
|
|
13
|
+
* @translation Error Translation Key = 's:upperCase'
|
|
14
|
+
*/
|
|
15
|
+
declare const upperCase: {
|
|
16
|
+
(): RequiredValidation;
|
|
17
|
+
key: string;
|
|
18
|
+
message: string;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export { upperCase };
|