chaik

0.0.4 • Public • Published

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

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

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)

Package Sidebar

Install

npm i chaik

Weekly Downloads

1

Version

0.0.4

License

ISC

Last publish

Collaborators

  • dragon753