redull
TypeScript icon, indicating that this package has built-in type declarations

0.0.4 • Public • Published

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

Package Sidebar

Install

npm i redull

Weekly Downloads

4

Version

0.0.4

License

MIT

Unpacked Size

2.69 kB

Total Files

4

Last publish

Collaborators

  • sureshkumar.on