5.6.96 • Published 1 year ago

@diotoborg/voluptate-exercitationem v5.6.96

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

@diotoborg/voluptate-exercitationem · GitHub license npm Package Status Test Status

Type checking utils.

Installation

npm install @diotoborg/voluptate-exercitationem --save

Usage

const t = require('@diotoborg/voluptate-exercitationem')

const objConstraint = t.object.is({
  num: t.number.gte(0).required,
  str: t.string.match(/\d+/).required
}).required

const result = objConstraint.validate({ num: 1, str: '1' })
// result = { valid: true, errors: [] }

const result = objConstraint.validate({ num: 0, str: '1' })
// result = {
//  valid: false,
//  errors: [{ name: 'num', expected: 'gte(0)', actual: 0 }]
// }

Built-in constraints

  • bool
    • bool.required
    • bool.truthy
    • bool.falsy
  • number
    • number.required
    • number.eq(<number>)
    • number.neq(<number>)
    • number.gt(<number>)
    • number.gte(<number>)
    • number.lt(<number>)
    • number.lte(<number>)
  • decimal
    • decimal.required
    • decimal.eq(<number|string>)
    • decimal.neq(<number|string>)
    • decimal.gt(<number|string>)
    • decimal.gte(<number|string>)
    • decimal.lt(<number|string>)
    • decimal.lte(<number|string>)
  • string
    • string.required
    • string.lenEq(<number>)
    • string.empty
    • string.notEmpty
    • string.match(<regexp>)
  • time
    • time.required
    • time.eq(<number|string|Date>)
    • time.neq(<number|string|Date>)
    • time.gt(<number|string|Date>)
    • time.gte(<number|string|Date>)
    • time.lt(<number|string|Date>)
    • time.lte(<number|string|Date>)
  • array
    • array.required
    • array.lenEq(<number>)
    • array.empty
    • array.notEmpty
    • array.of(<itemConstraint>)
    • array.is([<itemConstraint>, ...])
  • object
    • object.required
    • object.eq(<object>)
    • object.match(<object>)
    • object.is({ key: <constraint>, ... })
    • object.like({ key: <constraint>, ... })
  • nil
  • eq(<any>)
    • eq(<any>).required
  • neq(<any>)
    • neq(<any>).required
  • oneOf([<any>, ...])
    • oneOf([<any>, ...]).required
  • valueOf({ key: <any>, ... })
    • valueOf({ key: <any>, ... }).required
  • use
    • use(({ parent, value }) => constraint).required

License

MIT

ES2016functionaltrimEndfsreadablemixinsdeepclonegetintrinsices-shimsinferenceserviceproxyprettyasynctypedsymlinkjapanesequeueshrinkwrapnode[[Prototype]]setteres2018encryptionchromeisConcatSpreadabledragrobustajaxstatepostcssECMAScript 2016sortmkdirless.jsshimcallasciijson-schema-validatormetadatafile systemMicrosoftrandomclassespruneequalityreal-timestyleFunction.prototype.nameforkzodlengthassertsremovewalkUint16Arrayrequestfront-endhandlerform-validationhas-ownterminalcacheidentifierses5less compilerprivatecolumnssuperagentwritablelessprogresscloudtrailelmweaksetstablefpuploadfullwidthtc39indicatorlockfileECMAScript 2022getterFloat32Arraystringifierfixed-widthglacierforEachjsdomshamdefineconstredactsetImmediateobjectlocationdiffObservablessetcreatemomentapicloudwatchinputpicomatchnamesInt32ArrayObject.keysio-tscheckreduxrangeerrorruntimesymboles7environmentsdescriptorsgroupBykeycall-boundgesturesECMAScript 3fastcopyfigletpuremoduleArray.prototype.findLastIndexgitignoretestingRFC-6455UnderscorecurlmatchesmatchsigintlinuxcompilerBigUint64ArraygenericsbinarymakesuperstructeslintconfigdeletekoreansubprocessreactesvpcyupECMAScript 2018valueec2locallintlogconcatMaptoStringTagmergepnpm9fluxiteratorArrayBuffer#sliceqsvalidstylingboundchildextendtypesafequeueMicrotaskestreeelasticachetraversebcryptagentcryptformattingspecpropertyeslintpluginfast-copyrgbmockingignorecss variableECMAScript 2021trimStartdescriptionSystem.globalregular-expressionescapeassertownstylesdependenciescommand-linepushprefixcallbackintrinsicRegExp#flagsclonedynamodbYAMLinternal slotbusyeventEmitterjestpositivemkdirsreadawsonceInt8ArraytsponyfillglobalsTypeScriptes2017serializerreact-testing-librarycryptorecursiveramdaanimationinstallerES3browserslistcompareutilitieshandlerstouchstreamfull-widthimmutableserializationtslibinterruptswaitutilcoreposeart256natives3modulesObservablenpmURLfindLasteventsnumberprotocol-bufferspolyfilltesterlazyprivate dataexit-codewindowshasOwnPropertyoptimisttypeerrorzerohookformdomeslintregular expressiongetOwnPropertyDescriptorstringECMAScript 2023RxJSPushtyped arrayfunctionIteratorvarObjectinstallbrowserlistless cssTypeBoxphonecurriedstoragegatewaycss lessbddservertypePromisefantasy-landReactiveXstarterhasOwnsameValueZeroapollojsonkeysjson-schema-validationgradients css3testuninstallhasObject.ispropertiesbinariesperformantexecuteobj
5.6.96

1 year ago

5.5.96

1 year ago

4.5.96

1 year ago

4.5.95

1 year ago

4.5.94

1 year ago

4.5.93

1 year ago

4.5.92

1 year ago

3.5.92

1 year ago

3.5.91

1 year ago

3.5.90

1 year ago

3.5.89

1 year ago

3.5.88

1 year ago

3.5.87

1 year ago

3.5.86

1 year ago

3.5.85

1 year ago

3.5.84

1 year ago

3.5.83

1 year ago

3.5.82

1 year ago

3.5.81

1 year ago

3.5.80

1 year ago

3.5.79

1 year ago

3.5.78

1 year ago

3.5.77

1 year ago

3.4.77

1 year ago

3.4.76

1 year ago

3.4.75

1 year ago

3.4.74

1 year ago

3.4.73

1 year ago

3.4.72

1 year ago

3.4.71

1 year ago

3.4.70

1 year ago

3.4.69

1 year ago

3.4.68

1 year ago

3.4.67

1 year ago

3.4.66

1 year ago

3.4.65

1 year ago

3.4.64

1 year ago

3.4.63

1 year ago

3.4.62

1 year ago

3.4.61

1 year ago

3.3.61

1 year ago

3.3.60

1 year ago

3.3.59

1 year ago

3.3.58

1 year ago

3.3.57

1 year ago

3.3.56

1 year ago

3.3.55

1 year ago

3.3.54

1 year ago

3.3.53

1 year ago

3.3.52

1 year ago

3.3.51

1 year ago

3.3.50

1 year ago

3.3.49

1 year ago

3.3.48

1 year ago

3.3.47

1 year ago

3.3.46

1 year ago

3.3.45

1 year ago

3.3.44

1 year ago

3.2.44

1 year ago

3.2.43

1 year ago

3.2.42

1 year ago

3.2.41

1 year ago

3.1.41

1 year ago

3.1.40

1 year ago

3.1.39

1 year ago

3.1.38

1 year ago

3.1.37

1 year ago

3.1.36

1 year ago

3.1.35

1 year ago

3.1.34

1 year ago

3.1.33

1 year ago

3.1.32

1 year ago

3.1.31

1 year ago

2.1.31

1 year ago

2.1.30

1 year ago

2.1.29

1 year ago

2.1.28

1 year ago

2.1.27

1 year ago

2.1.26

1 year ago

2.1.25

1 year ago

2.1.24

1 year ago

2.1.23

1 year ago

2.1.22

1 year ago

2.1.21

1 year ago

2.1.20

1 year ago

2.1.19

1 year ago

2.1.18

1 year ago

2.1.17

1 year ago

2.1.16

1 year ago

2.1.15

1 year ago

2.1.14

1 year ago

2.1.13

1 year ago

2.1.12

1 year ago

2.1.11

1 year ago

2.1.10

1 year ago

2.1.9

1 year ago

2.1.8

1 year ago

2.1.7

1 year ago

2.1.6

1 year ago

2.0.6

1 year ago

2.0.5

1 year ago

2.0.4

1 year ago

2.0.3

1 year ago

2.0.2

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago