How to use the ow.isValid function in ow

To help you get started, we’ve selected a few ow examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github BoostIO / BoostNote.next / src / lib / utils / predicates.spec.ts View on Github external
it('validates with nested schema', () => {
    const predicate = schema({
      parent: schema({
        stringProp: ow.string
      })
    })

    const result = ow.isValid({ parent: {} } as unknown, predicate)

    expect(result).toBe(false)
  })
})
github BoostIO / BoostNote.next / src / lib / utils / predicates.ts View on Github external
export function isValid(
  value: any,
  predicate: BasePredicate
): value is T {
  return ow.isValid(value, predicate)
}

ow

Function argument validation for humans

MIT
Latest version published 8 months ago

Package Health Score

78 / 100
Full package analysis