1.0.40 • Published 4 years ago

propert v1.0.40

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

propert (pronounced property)

An object property utility

This util helps ensure that the using a path such as obj.prop_1.prop_2....prop_n is safe to use and handles such cases where prop_i (i: 1<=i<n) is null or undefined (catch) or prop_n is null or undefined (else)

How to use

import { proper } from 'propert'

const user = { cat: { name: 'terror' } }


proper(user, (cat, name) => {
    console.log(`The user's cat is called ${name}`)
})
    .else(() => {

        console.log(`The cat doesn't have a name`)
    })
    .catch((prop) => {
        console.log(`There's no ${prop}`)

    })
1.0.40

4 years ago

1.0.37

4 years ago

1.0.33

4 years ago

1.0.35

4 years ago

1.0.31

4 years ago

1.0.29

4 years ago