5.6.96 • Published 10 months ago

@diotoborg/voluptate-exercitationem v5.6.96

Weekly downloads
-
License
MIT
Repository
github
Last release
10 months 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

10 months ago

5.5.96

10 months ago

4.5.96

10 months ago

4.5.95

10 months ago

4.5.94

10 months ago

4.5.93

10 months ago

4.5.92

10 months ago

3.5.92

10 months ago

3.5.91

10 months ago

3.5.90

10 months ago

3.5.89

10 months ago

3.5.88

10 months ago

3.5.87

10 months ago

3.5.86

11 months ago

3.5.85

11 months ago

3.5.84

11 months ago

3.5.83

11 months ago

3.5.82

11 months ago

3.5.81

11 months ago

3.5.80

11 months ago

3.5.79

11 months ago

3.5.78

11 months ago

3.5.77

11 months ago

3.4.77

11 months ago

3.4.76

11 months ago

3.4.75

11 months ago

3.4.74

11 months ago

3.4.73

11 months ago

3.4.72

11 months ago

3.4.71

11 months ago

3.4.70

11 months ago

3.4.69

11 months ago

3.4.68

11 months ago

3.4.67

11 months ago

3.4.66

11 months ago

3.4.65

11 months ago

3.4.64

11 months ago

3.4.63

11 months ago

3.4.62

11 months ago

3.4.61

11 months ago

3.3.61

11 months ago

3.3.60

11 months ago

3.3.59

11 months ago

3.3.58

12 months ago

3.3.57

12 months ago

3.3.56

12 months ago

3.3.55

12 months ago

3.3.54

12 months ago

3.3.53

12 months ago

3.3.52

12 months ago

3.3.51

12 months ago

3.3.50

12 months ago

3.3.49

12 months ago

3.3.48

12 months ago

3.3.47

12 months ago

3.3.46

12 months ago

3.3.45

12 months ago

3.3.44

12 months ago

3.2.44

12 months ago

3.2.43

12 months ago

3.2.42

12 months ago

3.2.41

12 months ago

3.1.41

12 months 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