Questions tagged [lodash]
A modern JavaScript utility library delivering modularity, performance, and extras.
lodash
7,001
questions
2
votes
1
answer
28
views
Race condition when using Lodash's _.once function
For example, take the following code:
const fetch = _.once(myRealFetch)
const queue = new PQueue({concurrency: 1000});
queue.add(function() {
const result = fetch()
// Rest of the code ...
})
...
-1
votes
0
answers
16
views
How can I convert a multidimensional array from x by y to y by x? [duplicate]
Given the 3x2 multidimensional array:
const arr = [
[1, 3, 5],
[2, 4, 6]
]
where (1,2) === 2 and where (3,1) === 5 and etc
How can I convert it to the 2x3 multidimensional array:
const arr = [
[...
2
votes
0
answers
39
views
lodash-es vs lodash bundle size comparison
There's a project I'm currently working on which uses regular lodash library. For now we use 3 util functions cloneDeep, isEmpty, and get.
Currently import statements are like so import util from '...
-2
votes
2
answers
42
views
I want to return a key using Lodash when it contains a particular value
I have an object like this:
const obj = {
'MONEY-OUT': {
USD: ['a', 'b', 'c'],
EUR: ['d', 'e', 'f'],
},
'MONEY-IN': {
USD: ['g', 'h', 'i'],
EUR: ['j', 'k', 'l'],
},
};
and I ...
0
votes
1
answer
79
views
npm build is failing due to lodash
Using
Node: 16.20.2
Angular: CLI 11.2.5
Typescript: 4.1.5
@types/lodash: 4.14.177
npm build started failing with below exception
Error: node modules/@types/lodash/common/object.d.ts:1026:46 error ...
1
vote
0
answers
14
views
`_.template` lodash feature is not compiling when moving from offline to online in mobile app development
I am using _.template from lodash to create a compiled template for Emails subject in my app development. Its working good in online..When I do something in offline app(which is offline enable app) ...
1
vote
0
answers
35
views
React Native Reanimated - How to compare shared value prop inside memo areEqualProps?
How to compare a SharedValue property inside memo callback?
_.isEqual(prevProps.animatedProgress, nextProps.animatedProgress)
prevProps.animatedProgress === nextProps.animatedProgress
_.isEqual(...
0
votes
0
answers
27
views
My webpack is building old lodash version
I'm having some troubles with my webpack when building source for deployment. Built files are always created with [email protected]. How can I exclude the lodash from the build process or upgrade it to ...
0
votes
0
answers
28
views
Many lodash functions give error in y custom WordPress plugin
I'm building a WordPress plugin using the WordPress Plugin Boilerplate and in the admin area I need to use the lodash function .startCase(). The problem is that in the console I get the error "....
3
votes
2
answers
77
views
Typescript generic object type from two arrays
Given two arrays, keyArr and valArr, how can I define a Typescript generic that would infer an object type <O> with keys from keyArr and values from valArr (as seen in this answer or in lodash _....
4
votes
5
answers
3k
views
npm run build is failing due to typescript or lodash uncompatibility
typescript version: 4.5.2
lodash version: 4.17.21
npm run build
tsc && react-scripts build
node_modules/@types/lodash/common/object.d.ts:1026:46 - error TS1005: '?' expected.
1026 : ...
0
votes
0
answers
20
views
Lodash chaining multiple set throws error in TypeScript
As far as I know, we can chain functions in lodash using chain(). But it seems that when used in typescript, it throws a TypeError.
I have this logic in typescript:
try {
// an async code here...
...
0
votes
0
answers
32
views
Lodash is wrapping my data locally. Is it doing that on the server as well?
I have a code running on a server where I can't output data within that code to see the status. All I know is that it isn't returning data properly. I am running the file locally with node and feeding ...
0
votes
0
answers
16
views
Using _.keyBy and spread operator doesn't returns expected type
"lodash": "4.17.21"
Try to transform the MarketReportDTO[] to TableRecord:
import _ from 'lodash';
const BillTermTextMap = {
0: "0m",
1: "1m",
} as const;
...
0
votes
2
answers
49
views
sort array in a date string property, using lodash or moment() or simple javascript
this is my test array:
let testArray = [{'Datum':'13/05/2024','ID':1},
{'Datum':'18/05/2013','ID':2},{'Datum':'01/05/2018','ID':3},
{'Datum':'31/05/2024','ID':4},{'Datum':'31/05/2024','ID':5}]
trying ...