Timeline for Remove blank attributes from an Object in Javascript
Current License: CC BY-SA 4.0
4 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Aug 3, 2018 at 20:10 | comment | added | Jason Cust |
Troll comment Two things regarding this being a functional pattern: within the stripNulls function it uses a reference from outside of the accumulator function's scope; and it also mixes the concerns by filtering within the accumulator function. π (e.g. Object.entries(o).filter(([k,v]) => v !== null).reduce((o, [k, v]) => {o[k] = v; return o;}, {});) Yes, it will loop over the filtered items twice but the realized perf loss there is negligible.
|
|
| Jul 30, 2018 at 19:38 | history | edited | Felippe Nardi | CC BY-SA 4.0 |
edited body
|
| Jul 30, 2018 at 19:26 | history | edited | Felippe Nardi | CC BY-SA 4.0 |
added 9 characters in body
|
| Jul 30, 2018 at 18:27 | history | answered | Felippe Nardi | CC BY-SA 4.0 |