Closed mtuchi closed 3 months ago
Sample test code for the fnIf
function
fn(state => {
state.name = 'ama';
state.users = [
{
name: 'mtuchi',
age: 'NaN',
},
{
name: 'Africa',
age: 'NaN',
},
];
return state;
});
fnIf(
state => state?.name,
state => {
console.log(state.name);
return state;
}
);
fnIf(
state => state.users.length > 1,
each($.users, state => {
console.log(state.data);
return state;
})
);
// Only if you export common/util 👇🏽
fnIf($?.name, async state => {
const { body } = await util.get('https://jsonplaceholder.typicode.com/users');
state.results = body;
return state;
});
Quick note: each adaptor needs to explicitly export this from common, and also needs a minor bump
I have updated each adaptor export fnIf
from common and bump their version to a minor
Oh man @mtuchi I was not ready for this to be released!
I guess I shouldn't have approved it. That was a "thanks, I'll take it from here" sort of approval. I did say I was going to look at the docs.
Because we've got a lot of common changes coming together, I wanted to do one big release (maybe even a major) with them all at once
My bad @josephjclark 🙌🏽 , I thought this was ready for release. I will make sure to ask before merging next time
Summary
Add
fnIf
operation in common, And prettier formatting made tiny change tocursor
functionRef #375
Review Checklist
Before merging, the reviewer should check the following items: