0.0.4 • Published 7 years ago

chaik v0.0.4

Weekly downloads
4
License
ISC
Repository
github
Last release
7 years ago

to verify a json object's structure

emtpy object

  • chaik.structure({},[])

no nested field

  • chaik.structure({a:1},"a")

nested field

  • chaik.structure({ a: 1, b: { c: 2 } },["a", { b: "c" }])

object array

optional field

  • chaik.structure({},"*a")
  • chaik.structure({ a: 1 },"*a")
  • chaik.structure({ a: 1 },"*a")
  • chaik.structure({ a: 1, b: { c: 2 } },["a", { "b": "c" }])

array field

  • chaik.structure({ a: { b: 1, 2, 3 }, { "a": { "b": [] } })

to verify data existance in db

init

pass in a standard knex connection config

chaik.initDbConnection(config)

to verify existance

  • chaik.in.database(objToVerify, tableName, searchCondition)
  • chaik.in.database(objectArrayToVerify, tableName, searchCondition)

ensure inexistance

  • chaik.notIn.database(tableName, searchCondition)