bguard 0.1.0 → 0.2.0
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 +567 -29
- package/lib/{CommonSchema-BbGNki0L.d.ts → CommonSchema-9RtxTxdX.d.ts} +3 -2
- package/lib/{CommonSchema-CjsYE4dC.d.mts → CommonSchema-DJmQ3F_9.d.mts} +3 -2
- package/lib/InferType.d.mts +5 -2
- package/lib/InferType.d.ts +5 -2
- package/lib/asserts/array/index.d.mts +4 -4
- package/lib/asserts/array/index.d.ts +4 -4
- package/lib/asserts/array/index.js +10 -5
- package/lib/asserts/array/index.js.map +1 -1
- package/lib/asserts/array/index.mjs +10 -5
- package/lib/asserts/array/index.mjs.map +1 -1
- package/lib/asserts/bigint/bigintMax.d.mts +22 -0
- package/lib/asserts/bigint/bigintMax.d.ts +22 -0
- package/lib/asserts/bigint/bigintMax.js +20 -0
- package/lib/asserts/bigint/bigintMax.js.map +1 -0
- package/lib/asserts/bigint/bigintMax.mjs +20 -0
- package/lib/asserts/bigint/bigintMax.mjs.map +1 -0
- package/lib/asserts/bigint/bigintMaxExcluded.d.mts +22 -0
- package/lib/asserts/bigint/bigintMaxExcluded.d.ts +22 -0
- package/lib/asserts/bigint/bigintMaxExcluded.js +20 -0
- package/lib/asserts/bigint/bigintMaxExcluded.js.map +1 -0
- package/lib/asserts/bigint/bigintMaxExcluded.mjs +20 -0
- package/lib/asserts/bigint/bigintMaxExcluded.mjs.map +1 -0
- package/lib/asserts/bigint/bigintMin.d.mts +22 -0
- package/lib/asserts/bigint/bigintMin.d.ts +22 -0
- package/lib/asserts/bigint/bigintMin.js +20 -0
- package/lib/asserts/bigint/bigintMin.js.map +1 -0
- package/lib/asserts/bigint/bigintMin.mjs +20 -0
- package/lib/asserts/bigint/bigintMin.mjs.map +1 -0
- package/lib/asserts/bigint/bigintMinExcluded.d.mts +22 -0
- package/lib/asserts/bigint/bigintMinExcluded.d.ts +22 -0
- package/lib/asserts/bigint/bigintMinExcluded.js +20 -0
- package/lib/asserts/bigint/bigintMinExcluded.js.map +1 -0
- package/lib/asserts/bigint/bigintMinExcluded.mjs +20 -0
- package/lib/asserts/bigint/bigintMinExcluded.mjs.map +1 -0
- package/lib/asserts/bigint/index.d.mts +18 -0
- package/lib/asserts/bigint/index.d.ts +18 -0
- package/lib/asserts/bigint/index.js +21 -0
- package/lib/asserts/bigint/index.js.map +1 -0
- package/lib/asserts/bigint/index.mjs +21 -0
- package/lib/asserts/bigint/index.mjs.map +1 -0
- package/lib/asserts/boolean/index.d.mts +4 -4
- package/lib/asserts/boolean/index.d.ts +4 -4
- package/lib/asserts/boolean/index.js +11 -6
- package/lib/asserts/boolean/index.js.map +1 -1
- package/lib/asserts/boolean/index.mjs +11 -6
- package/lib/asserts/boolean/index.mjs.map +1 -1
- package/lib/asserts/date/dateMax.d.mts +22 -0
- package/lib/asserts/date/dateMax.d.ts +22 -0
- package/lib/asserts/date/dateMax.js +28 -0
- package/lib/asserts/date/dateMax.js.map +1 -0
- package/lib/asserts/date/dateMax.mjs +28 -0
- package/lib/asserts/date/dateMax.mjs.map +1 -0
- package/lib/asserts/date/dateMin.d.mts +22 -0
- package/lib/asserts/date/dateMin.d.ts +22 -0
- package/lib/asserts/date/dateMin.js +28 -0
- package/lib/asserts/date/dateMin.js.map +1 -0
- package/lib/asserts/date/dateMin.mjs +28 -0
- package/lib/asserts/date/dateMin.mjs.map +1 -0
- package/lib/asserts/date/index.d.mts +17 -0
- package/lib/asserts/date/index.d.ts +17 -0
- package/lib/asserts/date/index.js +16 -0
- package/lib/asserts/date/index.js.map +1 -0
- package/lib/asserts/date/index.mjs +16 -0
- package/lib/asserts/date/index.mjs.map +1 -0
- package/lib/asserts/mix/equalTo.d.mts +1 -1
- package/lib/asserts/mix/equalTo.d.ts +1 -1
- package/lib/asserts/mix/equalTo.js +3 -3
- package/lib/asserts/mix/equalTo.mjs +2 -2
- package/lib/asserts/mix/index.d.mts +4 -3
- package/lib/asserts/mix/index.d.ts +4 -3
- package/lib/asserts/mix/index.js +9 -4
- package/lib/asserts/mix/index.js.map +1 -1
- package/lib/asserts/mix/index.mjs +9 -4
- package/lib/asserts/mix/index.mjs.map +1 -1
- package/lib/asserts/mix/oneOfValues.d.mts +1 -1
- package/lib/asserts/mix/oneOfValues.d.ts +1 -1
- package/lib/asserts/mix/oneOfValues.js +3 -3
- package/lib/asserts/mix/oneOfValues.mjs +2 -2
- package/lib/asserts/number/index.d.mts +4 -4
- package/lib/asserts/number/index.d.ts +4 -4
- package/lib/asserts/number/index.js +15 -9
- package/lib/asserts/number/index.js.map +1 -1
- package/lib/asserts/number/index.mjs +15 -9
- package/lib/asserts/number/index.mjs.map +1 -1
- package/lib/asserts/number/max.js +2 -2
- package/lib/asserts/number/max.mjs +1 -1
- package/lib/asserts/number/maxExcluded.js +2 -2
- package/lib/asserts/number/maxExcluded.mjs +1 -1
- package/lib/asserts/number/min.js +2 -2
- package/lib/asserts/number/min.mjs +1 -1
- package/lib/asserts/number/minExcluded.js +2 -2
- package/lib/asserts/number/minExcluded.mjs +1 -1
- package/lib/asserts/number/negative.js +2 -2
- package/lib/asserts/number/negative.mjs +1 -1
- package/lib/asserts/number/positive.js +2 -2
- package/lib/asserts/number/positive.mjs +1 -1
- package/lib/asserts/object/index.d.mts +4 -4
- package/lib/asserts/object/index.d.ts +4 -4
- package/lib/asserts/object/index.js +10 -5
- package/lib/asserts/object/index.js.map +1 -1
- package/lib/asserts/object/index.mjs +10 -5
- package/lib/asserts/object/index.mjs.map +1 -1
- 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.js +2 -2
- package/lib/asserts/string/email.mjs +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 -4
- package/lib/asserts/string/index.d.ts +4 -4
- package/lib/asserts/string/index.js +15 -9
- package/lib/asserts/string/index.js.map +1 -1
- package/lib/asserts/string/index.mjs +15 -9
- package/lib/asserts/string/index.mjs.map +1 -1
- 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 +1 -1
- package/lib/asserts/string/maxLength.d.ts +1 -1
- package/lib/asserts/string/maxLength.js +2 -2
- package/lib/asserts/string/maxLength.js.map +1 -1
- package/lib/asserts/string/maxLength.mjs +1 -1
- package/lib/asserts/string/maxLength.mjs.map +1 -1
- package/lib/asserts/string/minLength.d.mts +1 -1
- package/lib/asserts/string/minLength.d.ts +1 -1
- package/lib/asserts/string/minLength.js +2 -2
- package/lib/asserts/string/minLength.js.map +1 -1
- package/lib/asserts/string/minLength.mjs +1 -1
- package/lib/asserts/string/minLength.mjs.map +1 -1
- package/lib/asserts/string/regExp.d.mts +1 -1
- package/lib/asserts/string/regExp.d.ts +1 -1
- package/lib/asserts/string/regExp.js +2 -2
- package/lib/asserts/string/regExp.js.map +1 -1
- package/lib/asserts/string/regExp.mjs +1 -1
- 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-RRQOET3X.js → chunk-2OINKFOA.js} +6 -6
- package/lib/{chunk-RRQOET3X.js.map → chunk-2OINKFOA.js.map} +1 -1
- package/lib/{chunk-F5MSBL33.js → chunk-32J4WVLE.js} +21 -10
- package/lib/chunk-32J4WVLE.js.map +1 -0
- package/lib/chunk-356HMXOP.js +12 -0
- package/lib/chunk-356HMXOP.js.map +1 -0
- package/lib/chunk-42J6CHIO.js +7 -0
- package/lib/chunk-42J6CHIO.js.map +1 -0
- package/lib/{chunk-4CYIMDP2.js → chunk-4SPM2CSQ.js} +3 -3
- package/lib/chunk-4SPM2CSQ.js.map +1 -0
- package/lib/{chunk-WBERBAL4.js → chunk-4SR7J2I4.js} +6 -6
- package/lib/{chunk-WBERBAL4.js.map → chunk-4SR7J2I4.js.map} +1 -1
- package/lib/{chunk-DPBE7TAQ.mjs → chunk-4UF67IQ2.mjs} +3 -3
- package/lib/chunk-4UF67IQ2.mjs.map +1 -0
- package/lib/{chunk-RYVUYVEE.mjs → chunk-54RHVQFA.mjs} +2 -2
- package/lib/{chunk-YUESB2WV.mjs → chunk-5AO66YV5.mjs} +3 -3
- package/lib/{chunk-RQH4LXBW.js → chunk-5EIBKBYS.js} +21 -10
- package/lib/chunk-5EIBKBYS.js.map +1 -0
- package/lib/{chunk-IRG4OQAB.js → chunk-7GIRQ5EA.js} +7 -1
- package/lib/chunk-7GIRQ5EA.js.map +1 -0
- package/lib/chunk-ASZW6XRM.mjs +7 -0
- package/lib/chunk-ASZW6XRM.mjs.map +1 -0
- package/lib/{chunk-5BVJ6YMH.js → chunk-CQWI6YRI.js} +3 -2
- package/lib/chunk-CQWI6YRI.js.map +1 -0
- package/lib/{chunk-EGEHSELT.js → chunk-EQNVYAKS.js} +7 -7
- package/lib/chunk-EQNVYAKS.js.map +1 -0
- package/lib/chunk-GDSB7CDN.mjs +12 -0
- package/lib/chunk-GDSB7CDN.mjs.map +1 -0
- package/lib/chunk-LWAEUS2F.js +14 -0
- package/lib/{chunk-JSGZ7DKT.js.map → chunk-LWAEUS2F.js.map} +1 -1
- package/lib/{chunk-NNFYXHLU.mjs → chunk-M6OCVAUD.mjs} +2 -2
- package/lib/chunk-M6OCVAUD.mjs.map +1 -0
- package/lib/{chunk-PG2R7P7G.mjs → chunk-MRWZVTNH.mjs} +3 -3
- package/lib/{chunk-DJSLA2ZV.js → chunk-MTJJKWTP.js} +5 -5
- package/lib/{chunk-DJSLA2ZV.js.map → chunk-MTJJKWTP.js.map} +1 -1
- package/lib/{chunk-6TH3DBDK.js → chunk-N6YMNLXG.js} +8 -8
- package/lib/{chunk-6TH3DBDK.js.map → chunk-N6YMNLXG.js.map} +1 -1
- package/lib/{chunk-NDQM5OL4.mjs → chunk-PEWNA24X.mjs} +3 -3
- package/lib/{chunk-CCBCDJXS.mjs → chunk-PJI3DRGP.mjs} +3 -3
- package/lib/{chunk-TCQY2R3U.mjs → chunk-PVOHKGBW.mjs} +3 -3
- package/lib/chunk-QLVLZRHT.js +20 -0
- package/lib/chunk-QLVLZRHT.js.map +1 -0
- package/lib/{chunk-3HTYHE2X.mjs → chunk-QV4JDW3T.mjs} +3 -2
- package/lib/chunk-QV4JDW3T.mjs.map +1 -0
- package/lib/chunk-SEIKS6G7.js +61 -0
- package/lib/chunk-SEIKS6G7.js.map +1 -0
- package/lib/{chunk-FTLRX2XG.mjs → chunk-TP5I237J.mjs} +17 -6
- package/lib/chunk-TP5I237J.mjs.map +1 -0
- package/lib/chunk-UV4I7JZR.mjs +61 -0
- package/lib/chunk-UV4I7JZR.mjs.map +1 -0
- package/lib/{chunk-H7CPKW53.js → chunk-VGF3Y2EK.js} +5 -5
- package/lib/{chunk-H7CPKW53.js.map → chunk-VGF3Y2EK.js.map} +1 -1
- package/lib/{chunk-J4VKFJQK.js → chunk-WPHJ4QTB.js} +3 -3
- package/lib/chunk-WPHJ4QTB.js.map +1 -0
- package/lib/chunk-XFR7Y4XX.mjs +20 -0
- package/lib/chunk-XFR7Y4XX.mjs.map +1 -0
- package/lib/{chunk-PH2PMUZP.mjs → chunk-XZTZC73V.mjs} +7 -1
- package/lib/chunk-XZTZC73V.mjs.map +1 -0
- package/lib/{chunk-3O4WCRC2.mjs → chunk-YPAUFM3S.mjs} +2 -2
- package/lib/chunk-YPAUFM3S.mjs.map +1 -0
- package/lib/{chunk-CLG3QRZC.mjs → chunk-Z7OEFOAD.mjs} +17 -6
- package/lib/chunk-Z7OEFOAD.mjs.map +1 -0
- package/lib/codeGen.d.mts +1 -1
- package/lib/codeGen.d.ts +1 -1
- package/lib/codeGen.js +4 -2
- package/lib/codeGen.js.map +1 -1
- package/lib/codeGen.mjs +3 -1
- package/lib/codeGen.mjs.map +1 -1
- package/lib/commonTypes.d.mts +1 -0
- package/lib/commonTypes.d.ts +1 -0
- 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 +1 -1
- package/lib/helpers/core.d.ts +1 -1
- package/lib/helpers/core.js +3 -2
- package/lib/helpers/core.js.map +1 -1
- package/lib/helpers/core.mjs +2 -1
- package/lib/helpers/isValidDate.d.mts +3 -0
- package/lib/helpers/isValidDate.d.ts +3 -0
- package/lib/helpers/isValidDate.js +7 -0
- package/lib/helpers/isValidDate.js.map +1 -0
- package/lib/helpers/isValidDate.mjs +7 -0
- package/lib/helpers/isValidDate.mjs.map +1 -0
- package/lib/helpers/setStrictType.d.mts +1 -1
- package/lib/helpers/setStrictType.d.ts +1 -1
- package/lib/helpers/setStrictType.js +4 -3
- package/lib/helpers/setStrictType.js.map +1 -1
- package/lib/helpers/setStrictType.mjs +3 -2
- package/lib/index.d.mts +3 -7
- package/lib/index.d.ts +3 -7
- package/lib/index.js +6 -38
- package/lib/index.js.map +1 -1
- package/lib/index.mjs +6 -38
- package/lib/parse.d.mts +3 -1
- package/lib/parse.d.ts +3 -1
- package/lib/parse.js +5 -4
- package/lib/parse.js.map +1 -1
- package/lib/parse.mjs +4 -3
- package/lib/parseOrFail.d.mts +3 -1
- package/lib/parseOrFail.d.ts +3 -1
- package/lib/parseOrFail.js +5 -4
- package/lib/parseOrFail.js.map +1 -1
- package/lib/parseOrFail.mjs +4 -3
- package/lib/schemas/ArraySchema.d.mts +1 -1
- package/lib/schemas/ArraySchema.d.ts +1 -1
- package/lib/schemas/ArraySchema.js +5 -4
- package/lib/schemas/ArraySchema.js.map +1 -1
- package/lib/schemas/ArraySchema.mjs +4 -3
- package/lib/schemas/BigIntSchema.d.mts +32 -0
- package/lib/schemas/BigIntSchema.d.ts +32 -0
- package/lib/schemas/BigIntSchema.js +16 -0
- package/lib/schemas/BigIntSchema.js.map +1 -0
- package/lib/schemas/BigIntSchema.mjs +16 -0
- package/lib/schemas/BigIntSchema.mjs.map +1 -0
- package/lib/schemas/BooleanSchema.d.mts +1 -1
- package/lib/schemas/BooleanSchema.d.ts +1 -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 +1 -1
- package/lib/schemas/CommonSchema.d.ts +1 -1
- package/lib/schemas/CommonSchema.js +4 -3
- package/lib/schemas/CommonSchema.js.map +1 -1
- package/lib/schemas/CommonSchema.mjs +3 -2
- package/lib/schemas/DateSchema.d.mts +9 -0
- package/lib/schemas/DateSchema.d.ts +9 -0
- package/lib/schemas/DateSchema.js +11 -0
- package/lib/schemas/DateSchema.js.map +1 -0
- package/lib/schemas/DateSchema.mjs +11 -0
- package/lib/schemas/DateSchema.mjs.map +1 -0
- package/lib/schemas/NumberSchema.d.mts +2 -1
- package/lib/schemas/NumberSchema.d.ts +2 -1
- package/lib/schemas/NumberSchema.js +10 -8
- package/lib/schemas/NumberSchema.js.map +1 -1
- package/lib/schemas/NumberSchema.mjs +9 -7
- package/lib/schemas/ObjectSchema.d.mts +1 -1
- package/lib/schemas/ObjectSchema.d.ts +1 -1
- package/lib/schemas/ObjectSchema.js +5 -4
- package/lib/schemas/ObjectSchema.js.map +1 -1
- package/lib/schemas/ObjectSchema.mjs +4 -3
- package/lib/schemas/StringSchema.d.mts +2 -1
- package/lib/schemas/StringSchema.d.ts +2 -1
- package/lib/schemas/StringSchema.js +10 -8
- package/lib/schemas/StringSchema.js.map +1 -1
- package/lib/schemas/StringSchema.mjs +9 -7
- package/lib/translationMap.js +2 -2
- package/lib/translationMap.mjs +1 -1
- package/package.json +6 -1
- package/lib/chunk-2PM3K3OE.mjs +0 -13
- package/lib/chunk-2PM3K3OE.mjs.map +0 -1
- package/lib/chunk-3HTYHE2X.mjs.map +0 -1
- package/lib/chunk-3O4WCRC2.mjs.map +0 -1
- package/lib/chunk-4CYIMDP2.js.map +0 -1
- package/lib/chunk-4RNK3I74.js +0 -13
- package/lib/chunk-4RNK3I74.js.map +0 -1
- package/lib/chunk-5BVJ6YMH.js.map +0 -1
- package/lib/chunk-B6TFELXR.mjs +0 -13
- package/lib/chunk-B6TFELXR.mjs.map +0 -1
- package/lib/chunk-CLG3QRZC.mjs.map +0 -1
- package/lib/chunk-DPBE7TAQ.mjs.map +0 -1
- package/lib/chunk-EGEHSELT.js.map +0 -1
- package/lib/chunk-F5MSBL33.js.map +0 -1
- package/lib/chunk-FTLRX2XG.mjs.map +0 -1
- package/lib/chunk-HDSGCAHH.js +0 -13
- package/lib/chunk-HDSGCAHH.js.map +0 -1
- package/lib/chunk-IEUXIOL6.js +0 -13
- package/lib/chunk-IEUXIOL6.js.map +0 -1
- package/lib/chunk-IRG4OQAB.js.map +0 -1
- package/lib/chunk-J4VKFJQK.js.map +0 -1
- package/lib/chunk-JDGZCBXF.mjs +0 -13
- package/lib/chunk-JDGZCBXF.mjs.map +0 -1
- package/lib/chunk-JSGZ7DKT.js +0 -14
- package/lib/chunk-MRISXZQ4.mjs +0 -13
- package/lib/chunk-MRISXZQ4.mjs.map +0 -1
- package/lib/chunk-NNFYXHLU.mjs.map +0 -1
- package/lib/chunk-NTC2XQ36.mjs +0 -13
- package/lib/chunk-NTC2XQ36.mjs.map +0 -1
- package/lib/chunk-PH2PMUZP.mjs.map +0 -1
- package/lib/chunk-QQNQ4IDN.js +0 -13
- package/lib/chunk-QQNQ4IDN.js.map +0 -1
- package/lib/chunk-RL4MSI7R.js +0 -13
- package/lib/chunk-RL4MSI7R.js.map +0 -1
- package/lib/chunk-RQH4LXBW.js.map +0 -1
- package/lib/chunk-VHEA4JZ5.js +0 -13
- package/lib/chunk-VHEA4JZ5.js.map +0 -1
- package/lib/chunk-YML32TPA.mjs +0 -13
- package/lib/chunk-YML32TPA.mjs.map +0 -1
- /package/lib/{chunk-RYVUYVEE.mjs.map → chunk-54RHVQFA.mjs.map} +0 -0
- /package/lib/{chunk-YUESB2WV.mjs.map → chunk-5AO66YV5.mjs.map} +0 -0
- /package/lib/{chunk-PG2R7P7G.mjs.map → chunk-MRWZVTNH.mjs.map} +0 -0
- /package/lib/{chunk-NDQM5OL4.mjs.map → chunk-PEWNA24X.mjs.map} +0 -0
- /package/lib/{chunk-CCBCDJXS.mjs.map → chunk-PJI3DRGP.mjs.map} +0 -0
- /package/lib/{chunk-TCQY2R3U.mjs.map → chunk-PVOHKGBW.mjs.map} +0 -0
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { RequiredValidation } from '../../commonTypes.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @description Asserts that a string value contains at least one lowercase character.
|
|
5
|
+
* @returns {RequiredValidation} A validation function that takes a received string and an exception context.
|
|
6
|
+
* @throws {ValidationError} if the received value does not contain at least one lowercase character.
|
|
7
|
+
* @example
|
|
8
|
+
* const schema = string().custom(atLeastOneLowerChar());
|
|
9
|
+
* parseOrFail(schema, 'abcDEF'); // Valid
|
|
10
|
+
* parseOrFail(schema, 'ABCDEF'); // Throws an error: 'The received value does not contain at least one lowercase character'
|
|
11
|
+
*
|
|
12
|
+
* @translation Error Translation Key = 's:atLeastOneLowerChar'
|
|
13
|
+
*/
|
|
14
|
+
declare const atLeastOneLowerChar: {
|
|
15
|
+
(): RequiredValidation;
|
|
16
|
+
key: string;
|
|
17
|
+
message: string;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export { atLeastOneLowerChar };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
+
|
|
3
|
+
var _chunkCQWI6YRIjs = require('../../chunk-CQWI6YRI.js');
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
var _chunkWK4O3HH4js = require('../../chunk-WK4O3HH4.js');
|
|
7
|
+
|
|
8
|
+
// src/asserts/string/atLeastOneLowerChar.ts
|
|
9
|
+
var atLeastOneLowerCharErrorMessage = "The received value does not contain at least one lowercase character";
|
|
10
|
+
var atLeastOneLowerCharErrorKey = "s:atLeastOneLowerChar";
|
|
11
|
+
var atLeastOneLowerChar = () => (received, ctx) => {
|
|
12
|
+
const lowerCharRegExp = /[a-z]/;
|
|
13
|
+
if (!lowerCharRegExp.test(received))
|
|
14
|
+
_chunkWK4O3HH4js.guardException.call(void 0, "at least one lowercase character", received, ctx, atLeastOneLowerCharErrorKey);
|
|
15
|
+
};
|
|
16
|
+
atLeastOneLowerChar.key = atLeastOneLowerCharErrorKey;
|
|
17
|
+
atLeastOneLowerChar.message = atLeastOneLowerCharErrorMessage;
|
|
18
|
+
_chunkCQWI6YRIjs.setToDefaultLocale.call(void 0, atLeastOneLowerChar);
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
exports.atLeastOneLowerChar = atLeastOneLowerChar;
|
|
22
|
+
//# sourceMappingURL=atLeastOneLowerChar.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/home/runner/work/bguard/bguard/lib/asserts/string/atLeastOneLowerChar.js","../../../src/asserts/string/atLeastOneLowerChar.ts"],"names":[],"mappings":"AAAA;AACE;AACF,0DAAgC;AAChC;AACE;AACF,0DAAgC;AAChC;AACA;ACHA,IAAM,gCAAA,EAAkC,sEAAA;AACxC,IAAM,4BAAA,EAA8B,uBAAA;AAa7B,IAAM,oBAAA,EAAsB,CAAA,EAAA,GAA0B,CAAC,QAAA,EAAkB,GAAA,EAAA,GAA0B;AACxG,EAAA,MAAM,gBAAA,EAAkB,OAAA;AACxB,EAAA,GAAA,CAAI,CAAC,eAAA,CAAgB,IAAA,CAAK,QAAQ,CAAA;AAChC,IAAA,6CAAA,kCAAe,EAAoC,QAAA,EAAU,GAAA,EAAK,2BAA2B,CAAA;AACjG,CAAA;AAEA,mBAAA,CAAoB,IAAA,EAAM,2BAAA;AAC1B,mBAAA,CAAoB,QAAA,EAAU,+BAAA;AAC9B,iDAAA,mBAAsC,CAAA;ADRtC;AACE;AACF,kDAAC","file":"/home/runner/work/bguard/bguard/lib/asserts/string/atLeastOneLowerChar.js","sourcesContent":[null,"import { ExceptionContext, RequiredValidation } from '../../commonTypes';\nimport { guardException } from '../../exceptions';\nimport { setToDefaultLocale } from '../../translationMap';\n\nconst atLeastOneLowerCharErrorMessage = 'The received value does not contain at least one lowercase character';\nconst atLeastOneLowerCharErrorKey = 's:atLeastOneLowerChar';\n\n/**\n * @description Asserts that a string value contains at least one lowercase character.\n * @returns {RequiredValidation} A validation function that takes a received string and an exception context.\n * @throws {ValidationError} if the received value does not contain at least one lowercase character.\n * @example\n * const schema = string().custom(atLeastOneLowerChar());\n * parseOrFail(schema, 'abcDEF'); // Valid\n * parseOrFail(schema, 'ABCDEF'); // Throws an error: 'The received value does not contain at least one lowercase character'\n *\n * @translation Error Translation Key = 's:atLeastOneLowerChar'\n */\nexport const atLeastOneLowerChar = (): RequiredValidation => (received: string, ctx: ExceptionContext) => {\n const lowerCharRegExp = /[a-z]/;\n if (!lowerCharRegExp.test(received))\n guardException('at least one lowercase character', received, ctx, atLeastOneLowerCharErrorKey);\n};\n\natLeastOneLowerChar.key = atLeastOneLowerCharErrorKey;\natLeastOneLowerChar.message = atLeastOneLowerCharErrorMessage;\nsetToDefaultLocale(atLeastOneLowerChar);\n"]}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import {
|
|
2
|
+
setToDefaultLocale
|
|
3
|
+
} from "../../chunk-QV4JDW3T.mjs";
|
|
4
|
+
import {
|
|
5
|
+
guardException
|
|
6
|
+
} from "../../chunk-7XFLH6R2.mjs";
|
|
7
|
+
|
|
8
|
+
// src/asserts/string/atLeastOneLowerChar.ts
|
|
9
|
+
var atLeastOneLowerCharErrorMessage = "The received value does not contain at least one lowercase character";
|
|
10
|
+
var atLeastOneLowerCharErrorKey = "s:atLeastOneLowerChar";
|
|
11
|
+
var atLeastOneLowerChar = () => (received, ctx) => {
|
|
12
|
+
const lowerCharRegExp = /[a-z]/;
|
|
13
|
+
if (!lowerCharRegExp.test(received))
|
|
14
|
+
guardException("at least one lowercase character", received, ctx, atLeastOneLowerCharErrorKey);
|
|
15
|
+
};
|
|
16
|
+
atLeastOneLowerChar.key = atLeastOneLowerCharErrorKey;
|
|
17
|
+
atLeastOneLowerChar.message = atLeastOneLowerCharErrorMessage;
|
|
18
|
+
setToDefaultLocale(atLeastOneLowerChar);
|
|
19
|
+
export {
|
|
20
|
+
atLeastOneLowerChar
|
|
21
|
+
};
|
|
22
|
+
//# sourceMappingURL=atLeastOneLowerChar.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/asserts/string/atLeastOneLowerChar.ts"],"sourcesContent":["import { ExceptionContext, RequiredValidation } from '../../commonTypes';\nimport { guardException } from '../../exceptions';\nimport { setToDefaultLocale } from '../../translationMap';\n\nconst atLeastOneLowerCharErrorMessage = 'The received value does not contain at least one lowercase character';\nconst atLeastOneLowerCharErrorKey = 's:atLeastOneLowerChar';\n\n/**\n * @description Asserts that a string value contains at least one lowercase character.\n * @returns {RequiredValidation} A validation function that takes a received string and an exception context.\n * @throws {ValidationError} if the received value does not contain at least one lowercase character.\n * @example\n * const schema = string().custom(atLeastOneLowerChar());\n * parseOrFail(schema, 'abcDEF'); // Valid\n * parseOrFail(schema, 'ABCDEF'); // Throws an error: 'The received value does not contain at least one lowercase character'\n *\n * @translation Error Translation Key = 's:atLeastOneLowerChar'\n */\nexport const atLeastOneLowerChar = (): RequiredValidation => (received: string, ctx: ExceptionContext) => {\n const lowerCharRegExp = /[a-z]/;\n if (!lowerCharRegExp.test(received))\n guardException('at least one lowercase character', received, ctx, atLeastOneLowerCharErrorKey);\n};\n\natLeastOneLowerChar.key = atLeastOneLowerCharErrorKey;\natLeastOneLowerChar.message = atLeastOneLowerCharErrorMessage;\nsetToDefaultLocale(atLeastOneLowerChar);\n"],"mappings":";;;;;;;;AAIA,IAAM,kCAAkC;AACxC,IAAM,8BAA8B;AAa7B,IAAM,sBAAsB,MAA0B,CAAC,UAAkB,QAA0B;AACxG,QAAM,kBAAkB;AACxB,MAAI,CAAC,gBAAgB,KAAK,QAAQ;AAChC,mBAAe,oCAAoC,UAAU,KAAK,2BAA2B;AACjG;AAEA,oBAAoB,MAAM;AAC1B,oBAAoB,UAAU;AAC9B,mBAAmB,mBAAmB;","names":[]}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { RequiredValidation } from '../../commonTypes.mjs';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @description Asserts that a string value contains at least one special character.
|
|
5
|
+
* @param {string} [allowedSpecialChars=* '@!#%&()^~{}'] The string containing allowed special characters. Defaults to '*@!#%&()^~{}'.
|
|
6
|
+
* @returns {RequiredValidation} A validation function that takes a received string and an exception context.
|
|
7
|
+
* @throws {ValidationError} if the received value does not contain at least one of the allowed special characters.
|
|
8
|
+
* @example
|
|
9
|
+
* const schema = string().custom(atLeastOneSpecialChar()); // Default special characters
|
|
10
|
+
* parseOrFail(schema, 'abc!def'); // Valid
|
|
11
|
+
* parseOrFail(schema, 'abcdef'); // Throws an error: 'The received value does not contain at least one special character'
|
|
12
|
+
*
|
|
13
|
+
* const customSchema = string().custom(atLeastOneSpecialChar('@$')); // Custom special characters
|
|
14
|
+
* parseOrFail(customSchema, 'abc@def'); // Valid
|
|
15
|
+
* parseOrFail(customSchema, 'abcdef'); // Throws an error: 'The received value does not contain at least one special character'
|
|
16
|
+
*
|
|
17
|
+
* @translation Error Translation Key = 's:atLeastOneSpecialChar'
|
|
18
|
+
*/
|
|
19
|
+
declare const atLeastOneSpecialChar: {
|
|
20
|
+
(allowedSpecialChars?: string): RequiredValidation;
|
|
21
|
+
key: string;
|
|
22
|
+
message: string;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export { atLeastOneSpecialChar };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { RequiredValidation } from '../../commonTypes.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @description Asserts that a string value contains at least one special character.
|
|
5
|
+
* @param {string} [allowedSpecialChars=* '@!#%&()^~{}'] The string containing allowed special characters. Defaults to '*@!#%&()^~{}'.
|
|
6
|
+
* @returns {RequiredValidation} A validation function that takes a received string and an exception context.
|
|
7
|
+
* @throws {ValidationError} if the received value does not contain at least one of the allowed special characters.
|
|
8
|
+
* @example
|
|
9
|
+
* const schema = string().custom(atLeastOneSpecialChar()); // Default special characters
|
|
10
|
+
* parseOrFail(schema, 'abc!def'); // Valid
|
|
11
|
+
* parseOrFail(schema, 'abcdef'); // Throws an error: 'The received value does not contain at least one special character'
|
|
12
|
+
*
|
|
13
|
+
* const customSchema = string().custom(atLeastOneSpecialChar('@$')); // Custom special characters
|
|
14
|
+
* parseOrFail(customSchema, 'abc@def'); // Valid
|
|
15
|
+
* parseOrFail(customSchema, 'abcdef'); // Throws an error: 'The received value does not contain at least one special character'
|
|
16
|
+
*
|
|
17
|
+
* @translation Error Translation Key = 's:atLeastOneSpecialChar'
|
|
18
|
+
*/
|
|
19
|
+
declare const atLeastOneSpecialChar: {
|
|
20
|
+
(allowedSpecialChars?: string): RequiredValidation;
|
|
21
|
+
key: string;
|
|
22
|
+
message: string;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export { atLeastOneSpecialChar };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }
|
|
2
|
+
|
|
3
|
+
var _chunkCQWI6YRIjs = require('../../chunk-CQWI6YRI.js');
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
var _chunkWK4O3HH4js = require('../../chunk-WK4O3HH4.js');
|
|
7
|
+
|
|
8
|
+
// src/asserts/string/atLeastOneSpecialChar.ts
|
|
9
|
+
var atLeastOneSpecialCharErrorMessage = "The received value does not contain at least one special character";
|
|
10
|
+
var atLeastOneSpecialCharErrorKey = "s:atLeastOneSpecialChar";
|
|
11
|
+
var atLeastOneSpecialChar = (allowedSpecialChars) => {
|
|
12
|
+
const specialCharRegExp = new RegExp(
|
|
13
|
+
`[${(_nullishCoalesce(allowedSpecialChars, () => ( "*@!#%&()^~{}"))).replace(/[-/\\^$*+?.()|[\]{}]/g, "\\$&")}]`
|
|
14
|
+
);
|
|
15
|
+
return (received, ctx) => {
|
|
16
|
+
if (!specialCharRegExp.test(received))
|
|
17
|
+
_chunkWK4O3HH4js.guardException.call(void 0, "special character", received, ctx, atLeastOneSpecialCharErrorKey);
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
atLeastOneSpecialChar.key = atLeastOneSpecialCharErrorKey;
|
|
21
|
+
atLeastOneSpecialChar.message = atLeastOneSpecialCharErrorMessage;
|
|
22
|
+
_chunkCQWI6YRIjs.setToDefaultLocale.call(void 0, atLeastOneSpecialChar);
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
exports.atLeastOneSpecialChar = atLeastOneSpecialChar;
|
|
26
|
+
//# sourceMappingURL=atLeastOneSpecialChar.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/home/runner/work/bguard/bguard/lib/asserts/string/atLeastOneSpecialChar.js","../../../src/asserts/string/atLeastOneSpecialChar.ts"],"names":[],"mappings":"AAAA;AACE;AACF,0DAAgC;AAChC;AACE;AACF,0DAAgC;AAChC;AACA;ACHA,IAAM,kCAAA,EAAoC,oEAAA;AAC1C,IAAM,8BAAA,EAAgC,yBAAA;AAkB/B,IAAM,sBAAA,EAAwB,CAAC,mBAAA,EAAA,GAAqD;AACzF,EAAA,MAAM,kBAAA,EAAoB,IAAI,MAAA;AAAA,IAC5B,CAAA,CAAA,EAAA,kBAAK,mBAAA,UAAuB,gBAAA,CAAA,CAAgB,OAAA,CAAQ,uBAAA,EAAyB,MAAM,CAAC,CAAA,CAAA;AAAA,EACtF,CAAA;AACA,EAAA,OAAO,CAAC,QAAA,EAAkB,GAAA,EAAA,GAA0B;AAClD,IAAA,GAAA,CAAI,CAAC,iBAAA,CAAkB,IAAA,CAAK,QAAQ,CAAA;AAClC,MAAA,6CAAA,mBAAe,EAAqB,QAAA,EAAU,GAAA,EAAK,6BAA6B,CAAA;AAAA,EACpF,CAAA;AACF,CAAA;AAEA,qBAAA,CAAsB,IAAA,EAAM,6BAAA;AAC5B,qBAAA,CAAsB,QAAA,EAAU,iCAAA;AAChC,iDAAA,qBAAwC,CAAA;ADbxC;AACE;AACF,sDAAC","file":"/home/runner/work/bguard/bguard/lib/asserts/string/atLeastOneSpecialChar.js","sourcesContent":[null,"import { ExceptionContext, RequiredValidation } from '../../commonTypes';\nimport { guardException } from '../../exceptions';\nimport { setToDefaultLocale } from '../../translationMap';\n\nconst atLeastOneSpecialCharErrorMessage = 'The received value does not contain at least one special character';\nconst atLeastOneSpecialCharErrorKey = 's:atLeastOneSpecialChar';\n\n/**\n * @description Asserts that a string value contains at least one special character.\n * @param {string} [allowedSpecialChars=* '@!#%&()^~{}'] The string containing allowed special characters. Defaults to '*@!#%&()^~{}'.\n * @returns {RequiredValidation} A validation function that takes a received string and an exception context.\n * @throws {ValidationError} if the received value does not contain at least one of the allowed special characters.\n * @example\n * const schema = string().custom(atLeastOneSpecialChar()); // Default special characters\n * parseOrFail(schema, 'abc!def'); // Valid\n * parseOrFail(schema, 'abcdef'); // Throws an error: 'The received value does not contain at least one special character'\n *\n * const customSchema = string().custom(atLeastOneSpecialChar('@$')); // Custom special characters\n * parseOrFail(customSchema, 'abc@def'); // Valid\n * parseOrFail(customSchema, 'abcdef'); // Throws an error: 'The received value does not contain at least one special character'\n *\n * @translation Error Translation Key = 's:atLeastOneSpecialChar'\n */\nexport const atLeastOneSpecialChar = (allowedSpecialChars?: string): RequiredValidation => {\n const specialCharRegExp = new RegExp(\n `[${(allowedSpecialChars ?? '*@!#%&()^~{}').replace(/[-/\\\\^$*+?.()|[\\]{}]/g, '\\\\$&')}]`,\n );\n return (received: string, ctx: ExceptionContext) => {\n if (!specialCharRegExp.test(received))\n guardException('special character', received, ctx, atLeastOneSpecialCharErrorKey);\n };\n};\n\natLeastOneSpecialChar.key = atLeastOneSpecialCharErrorKey;\natLeastOneSpecialChar.message = atLeastOneSpecialCharErrorMessage;\nsetToDefaultLocale(atLeastOneSpecialChar);\n"]}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import {
|
|
2
|
+
setToDefaultLocale
|
|
3
|
+
} from "../../chunk-QV4JDW3T.mjs";
|
|
4
|
+
import {
|
|
5
|
+
guardException
|
|
6
|
+
} from "../../chunk-7XFLH6R2.mjs";
|
|
7
|
+
|
|
8
|
+
// src/asserts/string/atLeastOneSpecialChar.ts
|
|
9
|
+
var atLeastOneSpecialCharErrorMessage = "The received value does not contain at least one special character";
|
|
10
|
+
var atLeastOneSpecialCharErrorKey = "s:atLeastOneSpecialChar";
|
|
11
|
+
var atLeastOneSpecialChar = (allowedSpecialChars) => {
|
|
12
|
+
const specialCharRegExp = new RegExp(
|
|
13
|
+
`[${(allowedSpecialChars ?? "*@!#%&()^~{}").replace(/[-/\\^$*+?.()|[\]{}]/g, "\\$&")}]`
|
|
14
|
+
);
|
|
15
|
+
return (received, ctx) => {
|
|
16
|
+
if (!specialCharRegExp.test(received))
|
|
17
|
+
guardException("special character", received, ctx, atLeastOneSpecialCharErrorKey);
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
atLeastOneSpecialChar.key = atLeastOneSpecialCharErrorKey;
|
|
21
|
+
atLeastOneSpecialChar.message = atLeastOneSpecialCharErrorMessage;
|
|
22
|
+
setToDefaultLocale(atLeastOneSpecialChar);
|
|
23
|
+
export {
|
|
24
|
+
atLeastOneSpecialChar
|
|
25
|
+
};
|
|
26
|
+
//# sourceMappingURL=atLeastOneSpecialChar.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/asserts/string/atLeastOneSpecialChar.ts"],"sourcesContent":["import { ExceptionContext, RequiredValidation } from '../../commonTypes';\nimport { guardException } from '../../exceptions';\nimport { setToDefaultLocale } from '../../translationMap';\n\nconst atLeastOneSpecialCharErrorMessage = 'The received value does not contain at least one special character';\nconst atLeastOneSpecialCharErrorKey = 's:atLeastOneSpecialChar';\n\n/**\n * @description Asserts that a string value contains at least one special character.\n * @param {string} [allowedSpecialChars=* '@!#%&()^~{}'] The string containing allowed special characters. Defaults to '*@!#%&()^~{}'.\n * @returns {RequiredValidation} A validation function that takes a received string and an exception context.\n * @throws {ValidationError} if the received value does not contain at least one of the allowed special characters.\n * @example\n * const schema = string().custom(atLeastOneSpecialChar()); // Default special characters\n * parseOrFail(schema, 'abc!def'); // Valid\n * parseOrFail(schema, 'abcdef'); // Throws an error: 'The received value does not contain at least one special character'\n *\n * const customSchema = string().custom(atLeastOneSpecialChar('@$')); // Custom special characters\n * parseOrFail(customSchema, 'abc@def'); // Valid\n * parseOrFail(customSchema, 'abcdef'); // Throws an error: 'The received value does not contain at least one special character'\n *\n * @translation Error Translation Key = 's:atLeastOneSpecialChar'\n */\nexport const atLeastOneSpecialChar = (allowedSpecialChars?: string): RequiredValidation => {\n const specialCharRegExp = new RegExp(\n `[${(allowedSpecialChars ?? '*@!#%&()^~{}').replace(/[-/\\\\^$*+?.()|[\\]{}]/g, '\\\\$&')}]`,\n );\n return (received: string, ctx: ExceptionContext) => {\n if (!specialCharRegExp.test(received))\n guardException('special character', received, ctx, atLeastOneSpecialCharErrorKey);\n };\n};\n\natLeastOneSpecialChar.key = atLeastOneSpecialCharErrorKey;\natLeastOneSpecialChar.message = atLeastOneSpecialCharErrorMessage;\nsetToDefaultLocale(atLeastOneSpecialChar);\n"],"mappings":";;;;;;;;AAIA,IAAM,oCAAoC;AAC1C,IAAM,gCAAgC;AAkB/B,IAAM,wBAAwB,CAAC,wBAAqD;AACzF,QAAM,oBAAoB,IAAI;AAAA,IAC5B,KAAK,uBAAuB,gBAAgB,QAAQ,yBAAyB,MAAM,CAAC;AAAA,EACtF;AACA,SAAO,CAAC,UAAkB,QAA0B;AAClD,QAAI,CAAC,kBAAkB,KAAK,QAAQ;AAClC,qBAAe,qBAAqB,UAAU,KAAK,6BAA6B;AAAA,EACpF;AACF;AAEA,sBAAsB,MAAM;AAC5B,sBAAsB,UAAU;AAChC,mBAAmB,qBAAqB;","names":[]}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { RequiredValidation } from '../../commonTypes.mjs';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @description Asserts that a string value contains at least one uppercase character.
|
|
5
|
+
* @returns {RequiredValidation} A validation function that takes a received string and an exception context.
|
|
6
|
+
* @throws {ValidationError} if the received value does not contain at least one uppercase character.
|
|
7
|
+
* @example
|
|
8
|
+
* const schema = string().custom(atLeastOneUpperChar());
|
|
9
|
+
* parseOrFail(schema, 'abcDEF'); // Valid
|
|
10
|
+
* parseOrFail(schema, 'abcdef'); // Throws an error: 'The received value does not contain at least one uppercase character'
|
|
11
|
+
*
|
|
12
|
+
* @translation Error Translation Key = 's:atLeastOneUpperChar'
|
|
13
|
+
*/
|
|
14
|
+
declare const atLeastOneUpperChar: {
|
|
15
|
+
(): RequiredValidation;
|
|
16
|
+
key: string;
|
|
17
|
+
message: string;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export { atLeastOneUpperChar };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { RequiredValidation } from '../../commonTypes.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @description Asserts that a string value contains at least one uppercase character.
|
|
5
|
+
* @returns {RequiredValidation} A validation function that takes a received string and an exception context.
|
|
6
|
+
* @throws {ValidationError} if the received value does not contain at least one uppercase character.
|
|
7
|
+
* @example
|
|
8
|
+
* const schema = string().custom(atLeastOneUpperChar());
|
|
9
|
+
* parseOrFail(schema, 'abcDEF'); // Valid
|
|
10
|
+
* parseOrFail(schema, 'abcdef'); // Throws an error: 'The received value does not contain at least one uppercase character'
|
|
11
|
+
*
|
|
12
|
+
* @translation Error Translation Key = 's:atLeastOneUpperChar'
|
|
13
|
+
*/
|
|
14
|
+
declare const atLeastOneUpperChar: {
|
|
15
|
+
(): RequiredValidation;
|
|
16
|
+
key: string;
|
|
17
|
+
message: string;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export { atLeastOneUpperChar };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
+
|
|
3
|
+
var _chunkCQWI6YRIjs = require('../../chunk-CQWI6YRI.js');
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
var _chunkWK4O3HH4js = require('../../chunk-WK4O3HH4.js');
|
|
7
|
+
|
|
8
|
+
// src/asserts/string/atLeastOneUpperChar.ts
|
|
9
|
+
var atLeastOneUpperCharErrorMessage = "The received value does not contain at least one uppercase character";
|
|
10
|
+
var atLeastOneUpperCharErrorKey = "s:atLeastOneUpperChar";
|
|
11
|
+
var atLeastOneUpperChar = () => (received, ctx) => {
|
|
12
|
+
const upperCharRegExp = /[A-Z]/;
|
|
13
|
+
if (!upperCharRegExp.test(received))
|
|
14
|
+
_chunkWK4O3HH4js.guardException.call(void 0, "at least one uppercase character", received, ctx, atLeastOneUpperCharErrorKey);
|
|
15
|
+
};
|
|
16
|
+
atLeastOneUpperChar.key = atLeastOneUpperCharErrorKey;
|
|
17
|
+
atLeastOneUpperChar.message = atLeastOneUpperCharErrorMessage;
|
|
18
|
+
_chunkCQWI6YRIjs.setToDefaultLocale.call(void 0, atLeastOneUpperChar);
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
exports.atLeastOneUpperChar = atLeastOneUpperChar;
|
|
22
|
+
//# sourceMappingURL=atLeastOneUpperChar.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/home/runner/work/bguard/bguard/lib/asserts/string/atLeastOneUpperChar.js","../../../src/asserts/string/atLeastOneUpperChar.ts"],"names":[],"mappings":"AAAA;AACE;AACF,0DAAgC;AAChC;AACE;AACF,0DAAgC;AAChC;AACA;ACHA,IAAM,gCAAA,EAAkC,sEAAA;AACxC,IAAM,4BAAA,EAA8B,uBAAA;AAa7B,IAAM,oBAAA,EAAsB,CAAA,EAAA,GAA0B,CAAC,QAAA,EAAkB,GAAA,EAAA,GAA0B;AACxG,EAAA,MAAM,gBAAA,EAAkB,OAAA;AACxB,EAAA,GAAA,CAAI,CAAC,eAAA,CAAgB,IAAA,CAAK,QAAQ,CAAA;AAChC,IAAA,6CAAA,kCAAe,EAAoC,QAAA,EAAU,GAAA,EAAK,2BAA2B,CAAA;AACjG,CAAA;AAEA,mBAAA,CAAoB,IAAA,EAAM,2BAAA;AAC1B,mBAAA,CAAoB,QAAA,EAAU,+BAAA;AAC9B,iDAAA,mBAAsC,CAAA;ADRtC;AACE;AACF,kDAAC","file":"/home/runner/work/bguard/bguard/lib/asserts/string/atLeastOneUpperChar.js","sourcesContent":[null,"import { ExceptionContext, RequiredValidation } from '../../commonTypes';\nimport { guardException } from '../../exceptions';\nimport { setToDefaultLocale } from '../../translationMap';\n\nconst atLeastOneUpperCharErrorMessage = 'The received value does not contain at least one uppercase character';\nconst atLeastOneUpperCharErrorKey = 's:atLeastOneUpperChar';\n\n/**\n * @description Asserts that a string value contains at least one uppercase character.\n * @returns {RequiredValidation} A validation function that takes a received string and an exception context.\n * @throws {ValidationError} if the received value does not contain at least one uppercase character.\n * @example\n * const schema = string().custom(atLeastOneUpperChar());\n * parseOrFail(schema, 'abcDEF'); // Valid\n * parseOrFail(schema, 'abcdef'); // Throws an error: 'The received value does not contain at least one uppercase character'\n *\n * @translation Error Translation Key = 's:atLeastOneUpperChar'\n */\nexport const atLeastOneUpperChar = (): RequiredValidation => (received: string, ctx: ExceptionContext) => {\n const upperCharRegExp = /[A-Z]/;\n if (!upperCharRegExp.test(received))\n guardException('at least one uppercase character', received, ctx, atLeastOneUpperCharErrorKey);\n};\n\natLeastOneUpperChar.key = atLeastOneUpperCharErrorKey;\natLeastOneUpperChar.message = atLeastOneUpperCharErrorMessage;\nsetToDefaultLocale(atLeastOneUpperChar);\n"]}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import {
|
|
2
|
+
setToDefaultLocale
|
|
3
|
+
} from "../../chunk-QV4JDW3T.mjs";
|
|
4
|
+
import {
|
|
5
|
+
guardException
|
|
6
|
+
} from "../../chunk-7XFLH6R2.mjs";
|
|
7
|
+
|
|
8
|
+
// src/asserts/string/atLeastOneUpperChar.ts
|
|
9
|
+
var atLeastOneUpperCharErrorMessage = "The received value does not contain at least one uppercase character";
|
|
10
|
+
var atLeastOneUpperCharErrorKey = "s:atLeastOneUpperChar";
|
|
11
|
+
var atLeastOneUpperChar = () => (received, ctx) => {
|
|
12
|
+
const upperCharRegExp = /[A-Z]/;
|
|
13
|
+
if (!upperCharRegExp.test(received))
|
|
14
|
+
guardException("at least one uppercase character", received, ctx, atLeastOneUpperCharErrorKey);
|
|
15
|
+
};
|
|
16
|
+
atLeastOneUpperChar.key = atLeastOneUpperCharErrorKey;
|
|
17
|
+
atLeastOneUpperChar.message = atLeastOneUpperCharErrorMessage;
|
|
18
|
+
setToDefaultLocale(atLeastOneUpperChar);
|
|
19
|
+
export {
|
|
20
|
+
atLeastOneUpperChar
|
|
21
|
+
};
|
|
22
|
+
//# sourceMappingURL=atLeastOneUpperChar.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/asserts/string/atLeastOneUpperChar.ts"],"sourcesContent":["import { ExceptionContext, RequiredValidation } from '../../commonTypes';\nimport { guardException } from '../../exceptions';\nimport { setToDefaultLocale } from '../../translationMap';\n\nconst atLeastOneUpperCharErrorMessage = 'The received value does not contain at least one uppercase character';\nconst atLeastOneUpperCharErrorKey = 's:atLeastOneUpperChar';\n\n/**\n * @description Asserts that a string value contains at least one uppercase character.\n * @returns {RequiredValidation} A validation function that takes a received string and an exception context.\n * @throws {ValidationError} if the received value does not contain at least one uppercase character.\n * @example\n * const schema = string().custom(atLeastOneUpperChar());\n * parseOrFail(schema, 'abcDEF'); // Valid\n * parseOrFail(schema, 'abcdef'); // Throws an error: 'The received value does not contain at least one uppercase character'\n *\n * @translation Error Translation Key = 's:atLeastOneUpperChar'\n */\nexport const atLeastOneUpperChar = (): RequiredValidation => (received: string, ctx: ExceptionContext) => {\n const upperCharRegExp = /[A-Z]/;\n if (!upperCharRegExp.test(received))\n guardException('at least one uppercase character', received, ctx, atLeastOneUpperCharErrorKey);\n};\n\natLeastOneUpperChar.key = atLeastOneUpperCharErrorKey;\natLeastOneUpperChar.message = atLeastOneUpperCharErrorMessage;\nsetToDefaultLocale(atLeastOneUpperChar);\n"],"mappings":";;;;;;;;AAIA,IAAM,kCAAkC;AACxC,IAAM,8BAA8B;AAa7B,IAAM,sBAAsB,MAA0B,CAAC,UAAkB,QAA0B;AACxG,QAAM,kBAAkB;AACxB,MAAI,CAAC,gBAAgB,KAAK,QAAQ;AAChC,mBAAe,oCAAoC,UAAU,KAAK,2BAA2B;AACjG;AAEA,oBAAoB,MAAM;AAC1B,oBAAoB,UAAU;AAC9B,mBAAmB,mBAAmB;","names":[]}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { RequiredValidation } from '../../commonTypes.mjs';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @description Asserts that a string value contains a specified substring.
|
|
5
|
+
* @param {string} substring The substring that must be present in the string value.
|
|
6
|
+
* @returns {RequiredValidation} A validation function that takes a received string and an exception context.
|
|
7
|
+
* @throws {ValidationError} if the received value does not contain the required substring.
|
|
8
|
+
* @example
|
|
9
|
+
* const schema = string().custom(contains('foo'));
|
|
10
|
+
* parseOrFail(schema, 'foobar'); // Valid
|
|
11
|
+
* parseOrFail(schema, 'bar'); // Throws an error: 'The received value does not contain the required substring'
|
|
12
|
+
*
|
|
13
|
+
* @translation Error Translation Key = 's:contains'
|
|
14
|
+
*/
|
|
15
|
+
declare const contains: {
|
|
16
|
+
(substring: string): RequiredValidation;
|
|
17
|
+
key: string;
|
|
18
|
+
message: string;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export { contains };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { RequiredValidation } from '../../commonTypes.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @description Asserts that a string value contains a specified substring.
|
|
5
|
+
* @param {string} substring The substring that must be present in the string value.
|
|
6
|
+
* @returns {RequiredValidation} A validation function that takes a received string and an exception context.
|
|
7
|
+
* @throws {ValidationError} if the received value does not contain the required substring.
|
|
8
|
+
* @example
|
|
9
|
+
* const schema = string().custom(contains('foo'));
|
|
10
|
+
* parseOrFail(schema, 'foobar'); // Valid
|
|
11
|
+
* parseOrFail(schema, 'bar'); // Throws an error: 'The received value does not contain the required substring'
|
|
12
|
+
*
|
|
13
|
+
* @translation Error Translation Key = 's:contains'
|
|
14
|
+
*/
|
|
15
|
+
declare const contains: {
|
|
16
|
+
(substring: string): RequiredValidation;
|
|
17
|
+
key: string;
|
|
18
|
+
message: string;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export { contains };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
+
|
|
3
|
+
var _chunkCQWI6YRIjs = require('../../chunk-CQWI6YRI.js');
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
var _chunkWK4O3HH4js = require('../../chunk-WK4O3HH4.js');
|
|
7
|
+
|
|
8
|
+
// src/asserts/string/contains.ts
|
|
9
|
+
var containsErrorMessage = "The received value does not contain the required substring";
|
|
10
|
+
var containsErrorKey = "s:contains";
|
|
11
|
+
var contains = (substring) => (received, ctx) => {
|
|
12
|
+
if (!received.includes(substring)) {
|
|
13
|
+
_chunkWK4O3HH4js.guardException.call(void 0, `contains '${substring}'`, received, ctx, containsErrorKey);
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
contains.key = containsErrorKey;
|
|
17
|
+
contains.message = containsErrorMessage;
|
|
18
|
+
_chunkCQWI6YRIjs.setToDefaultLocale.call(void 0, contains);
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
exports.contains = contains;
|
|
22
|
+
//# sourceMappingURL=contains.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/home/runner/work/bguard/bguard/lib/asserts/string/contains.js","../../../src/asserts/string/contains.ts"],"names":[],"mappings":"AAAA;AACE;AACF,0DAAgC;AAChC;AACE;AACF,0DAAgC;AAChC;AACA;ACHA,IAAM,qBAAA,EAAuB,4DAAA;AAC7B,IAAM,iBAAA,EAAmB,YAAA;AAclB,IAAM,SAAA,EACX,CAAC,SAAA,EAAA,GACD,CAAC,QAAA,EAAkB,GAAA,EAAA,GAA0B;AAC3C,EAAA,GAAA,CAAI,CAAC,QAAA,CAAS,QAAA,CAAS,SAAS,CAAA,EAAG;AACjC,IAAA,6CAAA,CAAe,UAAA,EAAa,SAAS,CAAA,CAAA,CAAA,EAAK,QAAA,EAAU,GAAA,EAAK,gBAAgB,CAAA;AAAA,EAC3E;AACF,CAAA;AAEF,QAAA,CAAS,IAAA,EAAM,gBAAA;AACf,QAAA,CAAS,QAAA,EAAU,oBAAA;AACnB,iDAAA,QAA2B,CAAA;ADX3B;AACE;AACF,4BAAC","file":"/home/runner/work/bguard/bguard/lib/asserts/string/contains.js","sourcesContent":[null,"import { guardException } from '../../exceptions';\nimport { ExceptionContext, RequiredValidation } from '../../commonTypes';\nimport { setToDefaultLocale } from '../../translationMap';\n\nconst containsErrorMessage = 'The received value does not contain the required substring';\nconst containsErrorKey = 's:contains';\n\n/**\n * @description Asserts that a string value contains a specified substring.\n * @param {string} substring The substring that must be present in the string value.\n * @returns {RequiredValidation} A validation function that takes a received string and an exception context.\n * @throws {ValidationError} if the received value does not contain the required substring.\n * @example\n * const schema = string().custom(contains('foo'));\n * parseOrFail(schema, 'foobar'); // Valid\n * parseOrFail(schema, 'bar'); // Throws an error: 'The received value does not contain the required substring'\n *\n * @translation Error Translation Key = 's:contains'\n */\nexport const contains =\n (substring: string): RequiredValidation =>\n (received: string, ctx: ExceptionContext) => {\n if (!received.includes(substring)) {\n guardException(`contains '${substring}'`, received, ctx, containsErrorKey);\n }\n };\n\ncontains.key = containsErrorKey;\ncontains.message = containsErrorMessage;\nsetToDefaultLocale(contains);\n"]}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import {
|
|
2
|
+
setToDefaultLocale
|
|
3
|
+
} from "../../chunk-QV4JDW3T.mjs";
|
|
4
|
+
import {
|
|
5
|
+
guardException
|
|
6
|
+
} from "../../chunk-7XFLH6R2.mjs";
|
|
7
|
+
|
|
8
|
+
// src/asserts/string/contains.ts
|
|
9
|
+
var containsErrorMessage = "The received value does not contain the required substring";
|
|
10
|
+
var containsErrorKey = "s:contains";
|
|
11
|
+
var contains = (substring) => (received, ctx) => {
|
|
12
|
+
if (!received.includes(substring)) {
|
|
13
|
+
guardException(`contains '${substring}'`, received, ctx, containsErrorKey);
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
contains.key = containsErrorKey;
|
|
17
|
+
contains.message = containsErrorMessage;
|
|
18
|
+
setToDefaultLocale(contains);
|
|
19
|
+
export {
|
|
20
|
+
contains
|
|
21
|
+
};
|
|
22
|
+
//# sourceMappingURL=contains.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/asserts/string/contains.ts"],"sourcesContent":["import { guardException } from '../../exceptions';\nimport { ExceptionContext, RequiredValidation } from '../../commonTypes';\nimport { setToDefaultLocale } from '../../translationMap';\n\nconst containsErrorMessage = 'The received value does not contain the required substring';\nconst containsErrorKey = 's:contains';\n\n/**\n * @description Asserts that a string value contains a specified substring.\n * @param {string} substring The substring that must be present in the string value.\n * @returns {RequiredValidation} A validation function that takes a received string and an exception context.\n * @throws {ValidationError} if the received value does not contain the required substring.\n * @example\n * const schema = string().custom(contains('foo'));\n * parseOrFail(schema, 'foobar'); // Valid\n * parseOrFail(schema, 'bar'); // Throws an error: 'The received value does not contain the required substring'\n *\n * @translation Error Translation Key = 's:contains'\n */\nexport const contains =\n (substring: string): RequiredValidation =>\n (received: string, ctx: ExceptionContext) => {\n if (!received.includes(substring)) {\n guardException(`contains '${substring}'`, received, ctx, containsErrorKey);\n }\n };\n\ncontains.key = containsErrorKey;\ncontains.message = containsErrorMessage;\nsetToDefaultLocale(contains);\n"],"mappings":";;;;;;;;AAIA,IAAM,uBAAuB;AAC7B,IAAM,mBAAmB;AAclB,IAAM,WACX,CAAC,cACD,CAAC,UAAkB,QAA0B;AAC3C,MAAI,CAAC,SAAS,SAAS,SAAS,GAAG;AACjC,mBAAe,aAAa,SAAS,KAAK,UAAU,KAAK,gBAAgB;AAAA,EAC3E;AACF;AAEF,SAAS,MAAM;AACf,SAAS,UAAU;AACnB,mBAAmB,QAAQ;","names":[]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkCQWI6YRIjs = require('../../chunk-CQWI6YRI.js');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
var _chunkWK4O3HH4js = require('../../chunk-WK4O3HH4.js');
|
|
@@ -14,7 +14,7 @@ var email = () => (received, ctx) => {
|
|
|
14
14
|
};
|
|
15
15
|
email.key = emailErrorKey;
|
|
16
16
|
email.message = emailErrorMessage;
|
|
17
|
-
|
|
17
|
+
_chunkCQWI6YRIjs.setToDefaultLocale.call(void 0, email);
|
|
18
18
|
|
|
19
19
|
|
|
20
20
|
exports.email = email;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { RequiredValidation } from '../../commonTypes.mjs';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @description Asserts that a string value ends with a specified substring.
|
|
5
|
+
* @param {string} substring The substring that the string value must end 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 end with the required substring.
|
|
8
|
+
* @example
|
|
9
|
+
* const schema = string().custom(endsWith('bar'));
|
|
10
|
+
* parseOrFail(schema, 'foobar'); // Valid
|
|
11
|
+
* parseOrFail(schema, 'foofoo'); // Throws an error: 'The received value does not end with the required substring'
|
|
12
|
+
*
|
|
13
|
+
* @translation Error Translation Key = 's:endsWith'
|
|
14
|
+
*/
|
|
15
|
+
declare const endsWith: {
|
|
16
|
+
(substring: string): RequiredValidation;
|
|
17
|
+
key: string;
|
|
18
|
+
message: string;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export { endsWith };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { RequiredValidation } from '../../commonTypes.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @description Asserts that a string value ends with a specified substring.
|
|
5
|
+
* @param {string} substring The substring that the string value must end 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 end with the required substring.
|
|
8
|
+
* @example
|
|
9
|
+
* const schema = string().custom(endsWith('bar'));
|
|
10
|
+
* parseOrFail(schema, 'foobar'); // Valid
|
|
11
|
+
* parseOrFail(schema, 'foofoo'); // Throws an error: 'The received value does not end with the required substring'
|
|
12
|
+
*
|
|
13
|
+
* @translation Error Translation Key = 's:endsWith'
|
|
14
|
+
*/
|
|
15
|
+
declare const endsWith: {
|
|
16
|
+
(substring: string): RequiredValidation;
|
|
17
|
+
key: string;
|
|
18
|
+
message: string;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export { endsWith };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
+
|
|
3
|
+
var _chunkCQWI6YRIjs = require('../../chunk-CQWI6YRI.js');
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
var _chunkWK4O3HH4js = require('../../chunk-WK4O3HH4.js');
|
|
7
|
+
|
|
8
|
+
// src/asserts/string/endsWith.ts
|
|
9
|
+
var endsWithErrorMessage = "The received value does not end with the required substring";
|
|
10
|
+
var endsWithErrorKey = "s:endsWith";
|
|
11
|
+
var endsWith = (substring) => (received, ctx) => {
|
|
12
|
+
if (!received.endsWith(substring)) {
|
|
13
|
+
_chunkWK4O3HH4js.guardException.call(void 0, `ends with '${substring}'`, received, ctx, endsWithErrorKey);
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
endsWith.key = endsWithErrorKey;
|
|
17
|
+
endsWith.message = endsWithErrorMessage;
|
|
18
|
+
_chunkCQWI6YRIjs.setToDefaultLocale.call(void 0, endsWith);
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
exports.endsWith = endsWith;
|
|
22
|
+
//# sourceMappingURL=endsWith.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/home/runner/work/bguard/bguard/lib/asserts/string/endsWith.js","../../../src/asserts/string/endsWith.ts"],"names":[],"mappings":"AAAA;AACE;AACF,0DAAgC;AAChC;AACE;AACF,0DAAgC;AAChC;AACA;ACHA,IAAM,qBAAA,EAAuB,6DAAA;AAC7B,IAAM,iBAAA,EAAmB,YAAA;AAclB,IAAM,SAAA,EACX,CAAC,SAAA,EAAA,GACD,CAAC,QAAA,EAAkB,GAAA,EAAA,GAA0B;AAC3C,EAAA,GAAA,CAAI,CAAC,QAAA,CAAS,QAAA,CAAS,SAAS,CAAA,EAAG;AACjC,IAAA,6CAAA,CAAe,WAAA,EAAc,SAAS,CAAA,CAAA,CAAA,EAAK,QAAA,EAAU,GAAA,EAAK,gBAAgB,CAAA;AAAA,EAC5E;AACF,CAAA;AAEF,QAAA,CAAS,IAAA,EAAM,gBAAA;AACf,QAAA,CAAS,QAAA,EAAU,oBAAA;AACnB,iDAAA,QAA2B,CAAA;ADX3B;AACE;AACF,4BAAC","file":"/home/runner/work/bguard/bguard/lib/asserts/string/endsWith.js","sourcesContent":[null,"import { guardException } from '../../exceptions';\nimport { ExceptionContext, RequiredValidation } from '../../commonTypes';\nimport { setToDefaultLocale } from '../../translationMap';\n\nconst endsWithErrorMessage = 'The received value does not end with the required substring';\nconst endsWithErrorKey = 's:endsWith';\n\n/**\n * @description Asserts that a string value ends with a specified substring.\n * @param {string} substring The substring that the string value must end 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 end with the required substring.\n * @example\n * const schema = string().custom(endsWith('bar'));\n * parseOrFail(schema, 'foobar'); // Valid\n * parseOrFail(schema, 'foofoo'); // Throws an error: 'The received value does not end with the required substring'\n *\n * @translation Error Translation Key = 's:endsWith'\n */\nexport const endsWith =\n (substring: string): RequiredValidation =>\n (received: string, ctx: ExceptionContext) => {\n if (!received.endsWith(substring)) {\n guardException(`ends with '${substring}'`, received, ctx, endsWithErrorKey);\n }\n };\n\nendsWith.key = endsWithErrorKey;\nendsWith.message = endsWithErrorMessage;\nsetToDefaultLocale(endsWith);\n"]}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import {
|
|
2
|
+
setToDefaultLocale
|
|
3
|
+
} from "../../chunk-QV4JDW3T.mjs";
|
|
4
|
+
import {
|
|
5
|
+
guardException
|
|
6
|
+
} from "../../chunk-7XFLH6R2.mjs";
|
|
7
|
+
|
|
8
|
+
// src/asserts/string/endsWith.ts
|
|
9
|
+
var endsWithErrorMessage = "The received value does not end with the required substring";
|
|
10
|
+
var endsWithErrorKey = "s:endsWith";
|
|
11
|
+
var endsWith = (substring) => (received, ctx) => {
|
|
12
|
+
if (!received.endsWith(substring)) {
|
|
13
|
+
guardException(`ends with '${substring}'`, received, ctx, endsWithErrorKey);
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
endsWith.key = endsWithErrorKey;
|
|
17
|
+
endsWith.message = endsWithErrorMessage;
|
|
18
|
+
setToDefaultLocale(endsWith);
|
|
19
|
+
export {
|
|
20
|
+
endsWith
|
|
21
|
+
};
|
|
22
|
+
//# sourceMappingURL=endsWith.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/asserts/string/endsWith.ts"],"sourcesContent":["import { guardException } from '../../exceptions';\nimport { ExceptionContext, RequiredValidation } from '../../commonTypes';\nimport { setToDefaultLocale } from '../../translationMap';\n\nconst endsWithErrorMessage = 'The received value does not end with the required substring';\nconst endsWithErrorKey = 's:endsWith';\n\n/**\n * @description Asserts that a string value ends with a specified substring.\n * @param {string} substring The substring that the string value must end 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 end with the required substring.\n * @example\n * const schema = string().custom(endsWith('bar'));\n * parseOrFail(schema, 'foobar'); // Valid\n * parseOrFail(schema, 'foofoo'); // Throws an error: 'The received value does not end with the required substring'\n *\n * @translation Error Translation Key = 's:endsWith'\n */\nexport const endsWith =\n (substring: string): RequiredValidation =>\n (received: string, ctx: ExceptionContext) => {\n if (!received.endsWith(substring)) {\n guardException(`ends with '${substring}'`, received, ctx, endsWithErrorKey);\n }\n };\n\nendsWith.key = endsWithErrorKey;\nendsWith.message = endsWithErrorMessage;\nsetToDefaultLocale(endsWith);\n"],"mappings":";;;;;;;;AAIA,IAAM,uBAAuB;AAC7B,IAAM,mBAAmB;AAclB,IAAM,WACX,CAAC,cACD,CAAC,UAAkB,QAA0B;AAC3C,MAAI,CAAC,SAAS,SAAS,SAAS,GAAG;AACjC,mBAAe,cAAc,SAAS,KAAK,UAAU,KAAK,gBAAgB;AAAA,EAC5E;AACF;AAEF,SAAS,MAAM;AACf,SAAS,UAAU;AACnB,mBAAmB,QAAQ;","names":[]}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { StringSchema } from '../../schemas/StringSchema.mjs';
|
|
2
|
-
import '../../CommonSchema-
|
|
2
|
+
import '../../CommonSchema-DJmQ3F_9.mjs';
|
|
3
3
|
import '../../commonTypes.mjs';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
|
-
* Creates a new schema for validating string values.
|
|
7
|
-
*
|
|
6
|
+
* @description Creates a new schema for validating string values.
|
|
8
7
|
* @returns {StringSchema} A new instance of `StringSchema` for validating strings.
|
|
9
|
-
*
|
|
10
8
|
* @example
|
|
11
9
|
* const schema = string();
|
|
12
10
|
* parseOrFail(schema, 'hello'); // Validates successfully
|
|
13
11
|
* parseOrFail(schema, 123); // Throws a validation error
|
|
12
|
+
*
|
|
13
|
+
* @instance Of StringSchema
|
|
14
14
|
*/
|
|
15
15
|
declare function string(): StringSchema;
|
|
16
16
|
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { StringSchema } from '../../schemas/StringSchema.js';
|
|
2
|
-
import '../../CommonSchema-
|
|
2
|
+
import '../../CommonSchema-9RtxTxdX.js';
|
|
3
3
|
import '../../commonTypes.js';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
|
-
* Creates a new schema for validating string values.
|
|
7
|
-
*
|
|
6
|
+
* @description Creates a new schema for validating string values.
|
|
8
7
|
* @returns {StringSchema} A new instance of `StringSchema` for validating strings.
|
|
9
|
-
*
|
|
10
8
|
* @example
|
|
11
9
|
* const schema = string();
|
|
12
10
|
* parseOrFail(schema, 'hello'); // Validates successfully
|
|
13
11
|
* parseOrFail(schema, 123); // Throws a validation error
|
|
12
|
+
*
|
|
13
|
+
* @instance Of StringSchema
|
|
14
14
|
*/
|
|
15
15
|
declare function string(): StringSchema;
|
|
16
16
|
|
|
@@ -1,15 +1,21 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
require('../../chunk-
|
|
5
|
-
require('../../chunk-
|
|
6
|
-
require('../../chunk-
|
|
7
|
-
require('../../chunk-
|
|
8
|
-
require('../../chunk-
|
|
9
|
-
require('../../chunk-
|
|
10
|
-
require('../../chunk-
|
|
3
|
+
var _chunk32J4WVLEjs = require('../../chunk-32J4WVLE.js');
|
|
4
|
+
require('../../chunk-4SPM2CSQ.js');
|
|
5
|
+
require('../../chunk-WPHJ4QTB.js');
|
|
6
|
+
require('../../chunk-42J6CHIO.js');
|
|
7
|
+
require('../../chunk-LWAEUS2F.js');
|
|
8
|
+
require('../../chunk-EQNVYAKS.js');
|
|
9
|
+
require('../../chunk-7GIRQ5EA.js');
|
|
10
|
+
require('../../chunk-356HMXOP.js');
|
|
11
|
+
require('../../chunk-CQWI6YRI.js');
|
|
11
12
|
require('../../chunk-WK4O3HH4.js');
|
|
12
13
|
|
|
14
|
+
// src/asserts/string/index.ts
|
|
15
|
+
function string() {
|
|
16
|
+
return new (0, _chunk32J4WVLEjs.StringSchema)({ type: ["string"], requiredValidations: [] });
|
|
17
|
+
}
|
|
13
18
|
|
|
14
|
-
|
|
19
|
+
|
|
20
|
+
exports.string = string;
|
|
15
21
|
//# sourceMappingURL=index.js.map
|