@dztek/truth
TypeScript icon, indicating that this package has built-in type declarations

1.0.0-prerelease-k • Public • Published

@dztek/truth

Logic and validation framework

Prerelease:

This package may cause cause breaking changes or may break from time to time while the package format is being determined.

Open source git repo will be share via Gitlab soon. Contributors welcome.

Note:

You must create or import your own validation logic to make queries with the framework

Why?

Truth is a framework that makes any "truth evaluating" source queriable with text

Example:

Setup:

const { Validator } = require('@dztek/truth')
const luhn = require('luhn')
const validator = require('validator')

const rulePacks = [
  { definitions: { isCreditCard: luhn.validate } },
  { definitions: { isEmail: validator.isEmail }, ns: 'v' }
]

Use:

const truth = new Validator({ rulePacks })

truth.validate('4111111111111111', 'isCreditCard')

// works with namespace set above
truth.validate('joe@example.org', 'v:isEmail')

Readme

Keywords

none

Package Sidebar

Install

npm i @dztek/truth

Weekly Downloads

2

Version

1.0.0-prerelease-k

License

MIT

Unpacked Size

11.4 kB

Total Files

12

Last publish

Collaborators

  • hifalutin
  • dwayneford