0.0.4 • Published 6 years ago
redull v0.0.4
redull
redull library exported as a node.js module
Installation
npm install redullUsage
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`