Skip to content

2.0.0

Compare
Choose a tag to compare
@AlexGalays AlexGalays released this 15 Apr 14:29
· 31 commits to master since this release
  • Introduce a new module: idonttrustlikethat/extra which will contain various non critical validators that I found are still useful in many cases.

The rationale for a new extra module is that many people are doing import * as v from 'idonttrustlikethat' but I hope they do import {isoDate} from 'idonttrustlikethat/extra' and can beneficiate from tree shaking. There's not much to tree shake in the main module as it contain all the JSON validators and utilities around those. Also, extra is a nice showcase of how easy it is to create new validators from the basic building blocks.

Added new extra validators:

  • url
  • absoluteUrl
  • relativeUrl
  • minSize
  • nonEmpty
  • booleanFromString
  • numberFromString
  • intFromString

Breaking changes:

  • flatMap is renamed to and.
  • isoDate, recursion and snakeCaseTransformation are moved to extra.
  • withError() now takes a function with the first argument being the value that we tried to validate.