Nobody Preheats Microwaves

    @reliutg/vprops

    0.1.3 • Public • Published

    vprops

    Object property async validation

    Installation

    npm i @reliutg/vprops

    Usage

    import { vprops } from '@reliutg/vprops'
    
    const myObject = {
        title: 'aaaa',
        getName: '',
        isMale: true
    }
    
    const myValidations = {
        title: 'string',
        getName: 'function',
        isMale: 'boolean',
    }
    
    (async () => {
        // Validate a single property
        const a = await vprops(myObject, myValidations, 'isMale')
        console.log(a.isValid) // true
    
        // Also can validate multiple properties
        console.log(b.areValid) // false
    
        // Validate all object properties
        const b = await vprops(myObject, myValidations)
        console.log(b.areValid) // false
    
        // Check if some properties are valid
        console.log(b.someValid) // true
    })()

    Install

    npm i @reliutg/vprops

    DownloadsWeekly Downloads

    2

    Version

    0.1.3

    License

    MIT

    Unpacked Size

    2.5 kB

    Total Files

    4

    Last publish

    Collaborators

    • reliutg