Create operator to remove undefined props #6915
renatodysouza
started this conversation in
Ideas / Feature request
Replies: 1 comment 1 reply
-
It's probably easier to define a mapper function like const removeFalsyProps = (obj) => Object.fromEntries(
Object.entries(obj).filter(([, val]) => val)
);
of(myFormValue).pipe(
map(removeFalsyProps)
) |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
It is easy to resolve, but if this operator could exist.
Example
const myFormValue = {
name: 'John',
age: '',
city: ''
};
of(myFormValue ).pipe(removeUndefinedProps).subscribe(val => console.log(val)); // { name: john }
Beta Was this translation helpful? Give feedback.
All reactions