All notable changes to this project will be documented in this file.
4.0.0 - (2024-05-20)
- *: Add custom message options to all shapes, validators and constraints (#231) (44a5cea)
- 💥 BREAKING CHANGE: Most shapes and validators that were previously getters are now functions to allow for custom options. The following list should show all of the changes, but if we have forgot any and you get an error saying something should be a function where you have provided a constant it is safe to assume you simply need to add
()
to your code for it to work again. - 💥 BREAKING CHANGE:
PickDefined
utility type has been removed. - 💥 BREAKING CHANGE:
PickUndefinedMakeOptional
utility type has been removed. - 💥 BREAKING CHANGE:
NonNullObject
utility type has been removed. - 💥 BREAKING CHANGE:
s.any
is nows.any()
to allow for custom options as argument. - 💥 BREAKING CHANGE:
s.array(T).lengthEqual
is nows.array(T).lengthEqual()
to allow for custom options as argument. - 💥 BREAKING CHANGE:
s.array(T).lengthGreaterThan
is nows.array(T).lengthGreaterThan()
to allow for custom options as argument. - 💥 BREAKING CHANGE:
s.array(T).lengthGreaterThanOrEqual
is nows.array(T).lengthGreaterThanOrEqual()
to allow for custom options as argument. - 💥 BREAKING CHANGE:
s.array(T).lengthLessThan
is nows.array(T).lengthLessThan()
to allow for custom options as argument. - 💥 BREAKING CHANGE:
s.array(T).lengthLessThanOrEqual
is nows.array(T).lengthLessThanOrEqual()
to allow for custom options as argument. - 💥 BREAKING CHANGE:
s.array(T).lengthNotEqual
is nows.array(T).lengthNotEqual()
to allow for custom options as argument. - 💥 BREAKING CHANGE:
s.array(T).lengthRange
is nows.array(T).lengthRange()
to allow for custom options as argument. - 💥 BREAKING CHANGE:
s.array(T).lengthRangeExclusive
is nows.array(T).lengthRangeExclusive()
to allow for custom options as argument. - 💥 BREAKING CHANGE:
s.array(T).lengthRangeInclusive
is nows.array(T).lengthRangeInclusive()
to allow for custom options as argument. - 💥 BREAKING CHANGE:
s.array(T).unique
is nows.array(T).unique()
to allow for custom options as argument. - 💥 BREAKING CHANGE:
s.array
is nows.array()
to allow for custom options as argument. - 💥 BREAKING CHANGE:
s.bigint.divisibleBy
is nows.bigint().divisibleBy()
to allow for custom options as argument. - 💥 BREAKING CHANGE:
s.bigint.equal
is nows.bigint().equal()
to allow for custom options as argument. - 💥 BREAKING CHANGE:
s.bigint.greaterThan
is nows.bigint().greaterThan()
to allow for custom options as argument. - 💥 BREAKING CHANGE:
s.bigint.greaterThanOrEqual
is nows.bigint().greaterThanOrEqual()
to allow for custom options as argument. - 💥 BREAKING CHANGE:
s.bigint.lessThan
is nows.bigint().lessThan()
to allow for custom options as argument. - 💥 BREAKING CHANGE:
s.bigint.lessThanOrEqual
is nows.bigint().lessThanOrEqual()
to allow for custom options as argument. - 💥 BREAKING CHANGE:
s.bigint.notEqual
is nows.bigint().notEqual()
to allow for custom options as argument. - 💥 BREAKING CHANGE:
s.bigint().abs
is nows.bigint().abs()
to allow for custom options as second argument. - 💥 BREAKING CHANGE:
s.bigint().negative
is nows.bigint().negative()
to allow for custom options as second argument. - 💥 BREAKING CHANGE:
s.bigint().positive
is nows.bigint().positive()
to allow for custom options as second argument. - 💥 BREAKING CHANGE:
s.bigint
is nows.bigint()
to allow for custom options as argument. - 💥 BREAKING CHANGE:
s.bigInt64Array
is nows.bigInt64Array()
to allow for custom options as argument. - 💥 BREAKING CHANGE:
s.bigUint64Array
is nows.bigUint64Array()
to allow for custom options as argument. - 💥 BREAKING CHANGE:
s.boolean.false
is nows.boolean().false()
to allow for custom options as second argument. - 💥 BREAKING CHANGE:
s.boolean.true
is nows.boolean().true()
to allow for custom options as second argument. - 💥 BREAKING CHANGE:
s.boolean
is nows.boolean()
to allow for custom options as argument. - 💥 BREAKING CHANGE:
s.default(...)
now gets a second parameter to allow for custom options as argument. - 💥 BREAKING CHANGE:
s.default(...).default(...)
now gets a second parameter to allow for custom options as argument. - 💥 BREAKING CHANGE:
s.date.equal
is nows.date().equal()
to allow for custom options as argument. - 💥 BREAKING CHANGE:
s.date.greaterThan
is nows.date().greaterThan()
to allow for custom options as argument. - 💥 BREAKING CHANGE:
s.date.greaterThanOrEqual
is nows.date().greaterThanOrEqual()
to allow for custom options as argument. - 💥 BREAKING CHANGE:
s.date.invalid
is nows.date().invalid()
to allow for custom options as argument. - 💥 BREAKING CHANGE:
s.date.lessThan
is nows.date().lessThan()
to allow for custom options as argument. - 💥 BREAKING CHANGE:
s.date.lessThanOrEqual
is nows.date().lessThanOrEqual()
to allow for custom options as argument. - 💥 BREAKING CHANGE:
s.date.notEqual
is nows.date().notEqual()
to allow for custom options as argument. - 💥 BREAKING CHANGE:
s.date.valid
is nows.date().valid()
to allow for custom options as argument. - 💥 BREAKING CHANGE:
s.date
is nows.date()
to allow for custom options as argument. - 💥 BREAKING CHANGE:
s.enum(1, 2, 3)
is nows.enum([1, 2, 3])
to allow for custom options as second argument. - 💥 BREAKING CHANGE:
s.float32Array
is nows.float32Array()
to allow for custom options as argument. - 💥 BREAKING CHANGE:
s.float64Array
is nows.float64Array()
to allow for custom options as argument. - 💥 BREAKING CHANGE:
s.int16Array
is nows.int16Array()
to allow for custom options as argument. - 💥 BREAKING CHANGE:
s.int32Array
is nows.int32Array()
to allow for custom options as argument. - 💥 BREAKING CHANGE:
s.int8Array
is nows.int8Array()
to allow for custom options as argument. - 💥 BREAKING CHANGE:
s.never
is nows.never()
to allow for custom options as argument. - 💥 BREAKING CHANGE:
s.null
is nows.null()
to allow for custom options as argument. - 💥 BREAKING CHANGE:
s.nullable
is nows.nullable()
to allow for custom options as argument. - 💥 BREAKING CHANGE:
s.nullish
is nows.nullish()
to allow for custom options as argument. - 💥 BREAKING CHANGE:
s.nullish
is nows.nullish()
to allow for custom options as argument. - 💥 BREAKING CHANGE:
s.number.abs
is nows.number().abs()
to allow for custom options as argument. - 💥 BREAKING CHANGE:
s.number.ceil
is nows.number().ceil()
to allow for custom options as argument. - 💥 BREAKING CHANGE:
s.number.divisibleBy
is nows.number().divisibleBy()
to allow for custom options as argument. - 💥 BREAKING CHANGE:
s.number.equal
is nows.number().equal()
to allow for custom options as argument. - 💥 BREAKING CHANGE:
s.number.finite
is nows.number().finite()
to allow for custom options as argument. - 💥 BREAKING CHANGE:
s.number.floor
is nows.number().floor()
to allow for custom options as argument. - 💥 BREAKING CHANGE:
s.number.fround
is nows.number().fround()
to allow for custom options as argument. - 💥 BREAKING CHANGE:
s.number.greaterThan
is nows.number().greaterThan()
to allow for custom options as argument. - 💥 BREAKING CHANGE:
s.number.greaterThanOrEqual
is nows.number().greaterThanOrEqual()
to allow for custom options as argument. - 💥 BREAKING CHANGE:
s.number.int
is nows.number().int()
to allow for custom options as argument. - 💥 BREAKING CHANGE:
s.number.lessThan
is nows.number().lessThan()
to allow for custom options as argument. - 💥 BREAKING CHANGE:
s.number.lessThanOrEqual
is nows.number().lessThanOrEqual()
to allow for custom options as argument. - 💥 BREAKING CHANGE:
s.number.negative
is nows.number().negative()
to allow for custom options as argument. - 💥 BREAKING CHANGE:
s.number.notEqual
is nows.number().notEqual()
to allow for custom options as argument. - 💥 BREAKING CHANGE:
s.number.positive
is nows.number().positive()
to allow for custom options as argument. - 💥 BREAKING CHANGE:
s.number.round
is nows.number().round()
to allow for custom options as argument. - 💥 BREAKING CHANGE:
s.number.safeInt
is nows.number().safeInt()
to allow for custom options as argument. - 💥 BREAKING CHANGE:
s.number.sign
is nows.number().sign()
to allow for custom options as argument. - 💥 BREAKING CHANGE:
s.number.trunc
is nows.number().trunc()
to allow for custom options as argument. - 💥 BREAKING CHANGE:
s.number
is nows.number()
to allow for custom options as argument. - 💥 BREAKING CHANGE:
s.object.ignore
is nows.object().ignore()
to allow for custom options as argument. - 💥 BREAKING CHANGE:
s.object.partial
is nows.object().partial()
to allow for custom options as argument. - 💥 BREAKING CHANGE:
s.object.passthrough
is nows.object().passthrough()
to allow for custom options as argument. - 💥 BREAKING CHANGE:
s.object.required
is nows.object().required()
to allow for custom options as argument. - 💥 BREAKING CHANGE:
s.object.strict
is nows.object().strict()
to allow for custom options as argument. - 💥 BREAKING CHANGE:
s.optional
is nows.optional()
to allow for custom options as argument. - 💥 BREAKING CHANGE:
s.required(...)
now gets a second parameter to allow for custom options as argument. - 💥 BREAKING CHANGE:
s.set
is nows.set()
to allow for custom options as argument. - 💥 BREAKING CHANGE:
s.string.date
is nows.string().date()
to allow for custom options as argument. - 💥 BREAKING CHANGE:
s.string.email
is nows.string().email()
to allow for custom options as argument. - 💥 BREAKING CHANGE:
s.string.ipv4
is nows.string().ipv4()
to allow for custom options as argument. - 💥 BREAKING CHANGE:
s.string.ipv6
is nows.string().ipv6()
to allow for custom options as argument. - 💥 BREAKING CHANGE:
s.string().ip
is nows.string().ip()
to allow for custom options as argument. - 💥 BREAKING CHANGE:
s.string().lengthEqual
is nows.string().lengthEqual()
to allow for custom options as argument. - 💥 BREAKING CHANGE:
s.string().lengthGreaterThan
is nows.string().lengthGreaterThan()
to allow for custom options as argument. - 💥 BREAKING CHANGE:
s.string().lengthGreaterThanOrEqual
is nows.string().lengthGreaterThanOrEqual()
to allow for custom options as argument. - 💥 BREAKING CHANGE:
s.string().lengthLessThan
is nows.string().lengthLessThan()
to allow for custom options as argument. - 💥 BREAKING CHANGE:
s.string().lengthLessThanOrEqual
is nows.string().lengthLessThanOrEqual()
to allow for custom options as argument. - 💥 BREAKING CHANGE:
s.string().lengthNotEqual
is nows.string().lengthNotEqual()
to allow for custom options as argument. - 💥 BREAKING CHANGE:
s.string().phone
is nows.string().phone()
to allow for custom options as argument. - 💥 BREAKING CHANGE:
s.string().regex
is nows.string().regex()
to allow for custom options as argument. - 💥 BREAKING CHANGE:
s.string().url
is nows.string().url()
to allow for custom options as argument. - 💥 BREAKING CHANGE:
s.string
is nows.string()
to allow for custom options as argument. - 💥 BREAKING CHANGE:
s.tuple(1, 2, 3)
is nows.tuple([1, 2, 3])
to allow for custom options as second argument. - 💥 BREAKING CHANGE:
s.typedArray(T).byteLengthEqual
is nows.typedArray(T).byteLengthEqual()
to allow for custom options as argument. - 💥 BREAKING CHANGE:
s.typedArray(T).byteLengthGreaterThan
is nows.typedArray(T).byteLengthGreaterThan()
to allow for custom options as argument. - 💥 BREAKING CHANGE:
s.typedArray(T).byteLengthGreaterThanOrEqual
is nows.typedArray(T).byteLengthGreaterThanOrEqual()
to allow for custom options as argument. - 💥 BREAKING CHANGE:
s.typedArray(T).byteLengthLessThan
is nows.typedArray(T).byteLengthLessThan()
to allow for custom options as argument. - 💥 BREAKING CHANGE:
s.typedArray(T).byteLengthLessThanOrEqual
is nows.typedArray(T).byteLengthLessThanOrEqual()
to allow for custom options as argument. - 💥 BREAKING CHANGE:
s.typedArray(T).byteLengthNotEqual
is nows.typedArray(T).byteLengthNotEqual()
to allow for custom options as argument. - 💥 BREAKING CHANGE:
s.typedArray(T).byteLengthRange
is nows.typedArray(T).byteLengthRange()
to allow for custom options as argument. - 💥 BREAKING CHANGE:
s.typedArray(T).byteLengthRangeExclusive
is nows.typedArray(T).byteLengthRangeExclusive()
to allow for custom options as argument. - 💥 BREAKING CHANGE:
s.typedArray(T).byteLengthRangeInclusive
is nows.typedArray(T).byteLengthRangeInclusive()
to allow for custom options as argument. - 💥 BREAKING CHANGE:
s.typedArray(T).lengthEqual
is nows.typedArray(T).lengthEqual()
to allow for custom options as argument. - 💥 BREAKING CHANGE:
s.typedArray(T).lengthGreaterThan
is nows.typedArray(T).lengthGreaterThan()
to allow for custom options as argument. - 💥 BREAKING CHANGE:
s.typedArray(T).lengthGreaterThanOrEqual
is nows.typedArray(T).lengthGreaterThanOrEqual()
to allow for custom options as argument. - 💥 BREAKING CHANGE:
s.typedArray(T).lengthLessThan
is nows.typedArray(T).lengthLessThan()
to allow for custom options as argument. - 💥 BREAKING CHANGE:
s.typedArray(T).lengthLessThanOrEqual
is nows.typedArray(T).lengthLessThanOrEqual()
to allow for custom options as argument. - 💥 BREAKING CHANGE:
s.typedArray(T).lengthNotEqual
is nows.typedArray(T).lengthNotEqual()
to allow for custom options as argument. - 💥 BREAKING CHANGE:
s.typedArray(T).lengthRange
is nows.typedArray(T).lengthRange()
to allow for custom options as argument. - 💥 BREAKING CHANGE:
s.typedArray(T).lengthRangeExclusive
is nows.typedArray(T).lengthRangeExclusive()
to allow for custom options as argument. - 💥 BREAKING CHANGE:
s.typedArray(T).lengthRangeInclusive
is nows.typedArray(T).lengthRangeInclusive()
to allow for custom options as argument. - 💥 BREAKING CHANGE:
s.uint16Array
is nows.uint16Array()
to allow for custom options as argument. - 💥 BREAKING CHANGE:
s.uint32Array
is nows.uint32Array()
to allow for custom options as argument. - 💥 BREAKING CHANGE:
s.uint8Array
is nows.uint8Array()
to allow for custom options as argument. - 💥 BREAKING CHANGE:
s.uint8ClampedArray
is nows.uint8ClampedArray()
to allow for custom options as argument. - 💥 BREAKING CHANGE:
s.undefined
is nows.undefined()
to allow for custom options as argument. - 💥 BREAKING CHANGE:
s.union(1, 2, 3).required
is nows.union(1, 2, 3).required()
to allow for custom options as argument. - 💥 BREAKING CHANGE:
s.union(1, 2, 3)
is nows.union([1, 2, 3])
to allow for custom options as second argument. - 💥 BREAKING CHANGE:
s.unknown
is nows.unknown()
to allow for custom options as argument. - 💥 BREAKING CHANGE:
uniqueArray
is now a function (instead of a constant) to allow for custom options as argument. - 💥 BREAKING CHANGE:
dateInvalid
is now a function (instead of a constant) to allow for custom options as argument. - 💥 BREAKING CHANGE:
dateValid
is now a function (instead of a constant) to allow for custom options as argument. - 💥 BREAKING CHANGE:
numberFinite
is now a function (instead of a constant) to allow for custom options as argument. - 💥 BREAKING CHANGE:
numberInt
is now a function (instead of a constant) to allow for custom options as argument. - 💥 BREAKING CHANGE:
numberNaN
is now a function (instead of a constant) to allow for custom options as argument. - 💥 BREAKING CHANGE:
numberNotNaN
is now a function (instead of a constant) to allow for custom options as argument. - 💥 BREAKING CHANGE:
numberSafeInt
is now a function (instead of a constant) to allow for custom options as argument.
- 💥 BREAKING CHANGE: Most shapes and validators that were previously getters are now functions to allow for custom options. The following list should show all of the changes, but if we have forgot any and you get an error saying something should be a function where you have provided a constant it is safe to assume you simply need to add
3.9.7 - (2024-03-31)
- Allow engines.node >= 16 (a4d8c8d)
3.9.6 - (2024-01-19)
- Fixed commonjs typings export mapping (#341) (a5518aa)
3.9.5 - (2023-12-15)
- Properly publish all dist files (8e925fa)
3.9.4 - (2023-12-04)
- Properly split CJS and ESM (9bb1ff9)
- Update path to global file (d03b19f)
3.9.3 - (2023-10-13)
- Change email regex (#306) (c5d49cf)
3.9.2 - (2023-06-04)
- arrayvalidator: Fixed runaway type instantiation with TypeScript >=5.1 (#275) (f59d901)
3.9.1 - (2023-06-02)
- types: Move the
types
condition to the front (#273) (5a3e202)
3.9.0 - (2023-05-09)
- Resolve minor grammar mistake (#260) (62df609)
- Add BaseValidator.describe (#267) (d9e1a2d)
3.8.2 - (2023-04-02)
3.8.1 - (2022-12-15)
- Fixed lodash esm import (#230) (63def7b)
3.8.0 - (2022-12-11)
- Remove
NonNullObject
(#227) (04d3934)
- Add
when
constraint (#223) (8eade90)
3.7.1 - (2022-11-27)
- Fixed "jump to definition" for
undefinedToOptional
going to wrong symbol (#226) (6aab6d0)
- Add @legendhimslef as a contributor (499522a)
3.7.0 - (2022-10-02)
- Add
s.string.phone
(#202) (7d122d5)
3.6.0 - (2022-08-29)
- Typescript 4.8 compatibility (#179) (2281535)
- Add
Validator#is
(#183) (5114f95)
3.5.1 - (2022-07-17)
- Fast deep equal import (#155) (5ce8ff6)
3.5.0 - (2022-07-10)
- Port net module (#149) (5f26e32)
- Ensure browser compatibility (#150) (92d05d8)
- Fixed
s.array
type inference (#153) (a5948dc) - Fixed
shape#array
types (#146) (43016a0)
- Lazy validator (#147) (807666e)
- Reshape finally (#148) (d3751f6)
- arrays: Add unique (#141) (ad7af34)
3.4.1 - (2022-07-03)
- Move all type utilities to one file (#139) (61cab3d)
- Return array-validator from length* methods (#140) (75b1f9a)
- Typechecking for tests (#145) (273cdc8)
3.4.0 - (2022-06-29)
- Add
required
in object validation (#137) (928f7be)
3.3.2 - (2022-06-26)
- Make keys optional in object parsing (#134) (57a3719)
3.3.1 - (2022-06-22)
- Add generic type to parse (#133) (90c91aa)
3.3.0 - (2022-06-19)
- Compile for es2020 instead of es2021 (#128) (051344d)
- Allow passing functions in
setValidationEnabled
(#131) (e1991cf)
- Migrate to vitest (#126) (4d80969)
3.2.0 - (2022-06-11)
- Add disabling of validators (#125) (e17af95)
3.1.0 - (2022-06-04)
- ObjectValidator: Fix #121 (#122) (ecfad7e)
- readme: Clarify the difference between validations and schemas and add table of contents (#108) (dc492a3)
- StringValidator: Add date string checks (#106) (1b72907)
3.0.0 - (2022-05-06)
- Speed up object validation a LOT (#101) (817278e)
-
Expand method names (#100) (741490f)}
date.eq
has been renamed todate.equal
string.lengthLt
has been renamed tostring.lengthLessThan
string.lengthLe
has been renamed tostring.lengthLessThanOrEqual
string.lengthGt
has been renamed tostring.lengthGreaterThan
string.lengthGe
has been renamed tostring.lengthGreaterThanOrEqual
string.lengthEq
has been renamed tostring.lengthEqual
string.lengthNe
has been renamed tostring.lengthNotEqual
number.gt
has been renamed tonumber.greaterThan
number.ge
has been renamed tonumber.greaterThanOrEqual
number.lt
has been renamed tonumber.lessThan
number.le
has been renamed tonumber.lessThanOrEqual
number.eq
has been renamed tonumber.equal
number.ne
has been renamed tonumber.notEqual
bigint.gt
has been renamed tobigint.greaterThan
bigint.ge
has been renamed tobigint.greaterThanOrEqual
bigint.lt
has been renamed tobigint.lessThan
bigint.le
has been renamed tobigint.lessThanOrEqual
bigint.eq
has been renamed tobigint.equal
bigint.ne
has been renamed tobigint.notEqual
boolean.eq
has been renamed toboolean.equal
boolean.ne
has been renamed toboolean.notEqual
array.lengthLt
has been renamed toarray.lengthLessThan
array.lengthLe
has been renamed toarray.lengthLessThanOrEqual
array.lengthGt
has been renamed toarray.lengthGreaterThan
array.lengthGe
has been renamed toarray.lengthGreaterThanOrEqual
array.lengthEq
has been renamed toarray.lengthEqual
array.lengthNe
has been renamed toarray.lengthNotEqual
typedArray.lengthLt
has been renamed totypedArray.lengthLessThan
typedArray.lengthLe
has been renamed totypedArray.lengthLessThanOrEqual
typedArray.lengthGt
has been renamed totypedArray.lengthGreaterThan
typedArray.lengthGe
has been renamed totypedArray.lengthGreaterThanOrEqual
typedArray.lengthEq
has been renamed totypedArray.lengthEqual
typedArray.lengthNe
has been renamed totypedArray.lengthNotEqual
typedArray.byteLengthLt
has been renamed totypedArray.byteLengthLessThan
typedArray.byteLengthLe
has been renamed totypedArray.byteLengthLessThanOrEqual
typedArray.byteLengthGt
has been renamed totypedArray.byteLengthGreaterThan
typedArray.byteLengthGe
has been renamed totypedArray.byteLengthGreaterThanOrEqual
typedArray.byteLengthEq
has been renamed totypedArray.byteLengthEqual
typedArray.byteLengthNe
has been renamed totypedArray.byteLengthNotEqual
-
ObjectValidator: Don't run validation on arrays (#99) (c83b3d0)
- Add 2 utility types inspired by yup and co (#102) (2fef902)
2.2.0 - (2022-04-29)
- Ensure
BaseError
is exported as value (#95) (335d799)
- readme: Add todo notice for
reshape
andfunction
validations (#75) (d5f16f6)
- Add Typed Array (#78) (ca5ea5f)
- Optimize
NativeEnum
(#79) (e9ae280)
@sapphire/[email protected] - (2022-04-24)
- readme: Add todo notice for
reshape
andfunction
validations (#75) (d5f16f6)
- Optimize
NativeEnum
(#79) (e9ae280)
2.0.0 (2022-03-13)
- add
default
(#25) (378c51f) - add bigint methods (#32) (4c444c1)
- add MapValidator (#21) (c4d1258)
- add NativeEnum validator (#54) (7359042)
- add RecordValidator (#20) (8727427)
- add remaining string validations (#38) (1c2fd7b)
- add tuple (#39) (b7704bf)
- added number transformers (#17) (89a8ddd)
- allow the use of module: NodeNext (#55) (e6827c5)
- array: add array length Comparators (#40) (1e564c2)
- Array: generate tuple types with given length (#52) (793648b)
- ArrayValidator: add length ranges (#53) (e431d62)
- display the property that errored (#35) (fe188b0)
- improve how errors are returned (#29) (8bc7669)
- s.object: add passthrough (#66) (ee9f6f3)
- copy/paste error and
ge
(#22) (fe6505f) - fix union type and add test (#41) (fbcf8a9)
- s.union: fix union overrides (#62) (56e9b19)
- added more primitives (#2) (16af17b)
- added more things (7c73d82)
- added ObjectValidator (#3) (abe7ead)
- resolved install error (a5abe13)