0.0.4 • Published 5 years ago

redull v0.0.4

Weekly downloads
1
License
MIT
Repository
-
Last release
5 years ago

redull

redull library exported as a node.js module

Installation

npm install redull

Usage

const foo = (response !=null && response.data !=null && response.data.item !=null && response.data.item.id != null) ? response.data.item.id : ''

Instead of above condition, you can use below

Scenario 1:

This will return the actual value

import redull from 'redull'

const response = {
    data:{
        item: {
            id: "F56Gh"
        }
    }
}

const foo = redull.getVal(response,"data.item.id");
// result will be `F56Gh`

Scenario 2:

This will return undefined instead of breaking the code.

import redull from 'redull'

const response = {
    data:{
        item: {
            id: "F56Gh"
        }
    }
}

const foo = redull.getVal(response,"data.item.name");
// result will be `undefined`

License

MIT