Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to only import _(value)?

I'm reducing non-used import in my web project.

According to lodash.com, I can cherry-pick the methods I use, which is good.

ex:

var at = require('lodash/at');

But I don't know how to only import _(value).

I tried the following which doesn't work

const seq = require("lodash/seq");

Anyone can help?

like image 782
Vivien Hung Avatar asked Aug 31 '25 03:08

Vivien Hung


1 Answers

Probably you can import chain method. But I'm not sure if it works properly with cherry-picking.

const chain = require('lodash/chain');

P.s. check out the interesting article Why using _.chain is a mistake. and methods flow and flowRight

like image 199
wanjas Avatar answered Sep 02 '25 17:09

wanjas