DEV Community

Cover image for Angular - Array destructuring
Sandro Jhuliano Cagara
Sandro Jhuliano Cagara

Posted on • Edited on

3 3

Angular - Array destructuring

It's better to use array destructuring for some rxjs operators.

Instead of this:

return zip(paramOne$, paramTwo$).pipe(
     map((data) => { if(data[0]) {...} ...)})
);
Enter fullscreen mode Exit fullscreen mode

You can do it by this:

return zip(paramOne$, paramTwo$).pipe(
     map(([paramOne, paramTwo]) => { if(paramOne) {...} ...)})
);
Enter fullscreen mode Exit fullscreen mode

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs