r/javascript • • Mar 18 '19

What's your favorite, most useful javascript one-liner?

385 Upvotes

422 comments sorted by

View all comments

Show parent comments

4

u/jamesaw22 Mar 19 '19

Destructure from 'loadsh-es' so you can tree shake!

import { values, clone } from 'lodash-es';

0

u/[deleted] Mar 23 '19

[deleted]

1

u/BrQQQ Mar 23 '19

It’s something you do when you want to harvest fruits or get something else out of the tree

Or it removes dead code from your bundled output. Like say you have a utils.js with multiple unrelated exported functions, but you only need to use one function. Your bundled output will only contain that one function rather than the entire file.