Skip to main content

All Questions

0 votes
1 answer
80 views

How to deal with searching strings and array of strings in JS

_.get(params, "_q") outputs either string or array of strings. On my current code, when I type for example "hello, there", it translates to array of strings and as a result is says ...
Joseph's user avatar
  • 7,805
2 votes
0 answers
39 views

Avoid sorting in groupBy lodash method [duplicate]

I'm working on an array which needs to be grouped, but original order to be maintained. So I tried alternate solutions but still that is not maintaining original array order. Resulting Order should be ...
Abhishek Konnur's user avatar
0 votes
2 answers
1k views

Lodash groupBy() Method should be in same order as original array

I'm working on an array using groupBy lodash method, here the original array order does not exist on performing groupBy, is the any way to regain it after groupBy() const groupBy from "groupBy/...
Abhishek Konnur's user avatar
1 vote
7 answers
2k views

Create an array of object properties for each item that has the same key

I'm merging two objects together to create a filter object. However I want to group the merged objects property values where the keys are the same. So... [{category: 'furniture'}, {category: 'mirrors'}...
Dan Emery's user avatar
1 vote
1 answer
788 views

Push object in array when checkbox is checked and remove object when checkbox is unchecked in ReactJS

I am trying to implement a functionality where I want to push object into an array when the user checked it and remove it if the user unselects it. I have a menu where I am collecting user choices. I ...
Jonas's user avatar
  • 71
3 votes
3 answers
3k views

Update an array of objects using another array

i need to update the array of objects based on another array in ES6. Example let a = [ { id : 23, active :false, status:"" }, { id : 33, active :false, status:"" }, { id : ...
Sanjai kumar's user avatar
1 vote
3 answers
527 views

Merge 2 arrays and their properties based on timestamp

Currently, I have an array containing arrays of TableRowReading, such as let allTableReadings: TableRowReading[][]: interface TableRowReading { time: number; // We can think of the timestamp `time` ...
Wizard-of-Koz's user avatar
0 votes
1 answer
306 views

How sort this array of items by date in desc order (I used loadash sortBy but it returns oldest first while I need newest first)?

How can I sort this array of objects with dates using desc order? I tried loadsh sortBy if ( sort && sort == "new") { items = _.sortBy(items, (dateObj) => { return ...
NewTech Lover's user avatar
-2 votes
1 answer
98 views

How to move object in same array

I have an array of objects, I want to move any object In the same array. I really tried hard but did not a solution. could someone please help me with how to resolve this issue? [{name:'user 1'}, {...
Brad's user avatar
  • 1
1 vote
1 answer
87 views

how can I generate a new array by concatenate nested array objects by using lodash

I have an array of objects, and each objects may contain another array of objects, I want to concatenate values of nested array and generate a new array. For example lessons = [ { id: 1, ...
RH-st's user avatar
  • 157
1 vote
2 answers
170 views

How to remove all next elements from array in javascript or lodash

I have an array of object [{a:1},{a:2},{a:3},{a:4},{a:5}]. I want to find index of {a:3} and remove all next elements from index of {a:3}. Result should look like [{a:1},{a:2},{a:3}] and removed ...
Shopify Guy's user avatar
0 votes
2 answers
97 views

Merge and Dedupe Array of Complex Objects with Arrays

I have a pretty complex problem that I can't seem to figure out. I have two array of objects that I would like to merge scores for. It should merge/append certain properties based on the scores. For ...
Joey's user avatar
  • 1,876
0 votes
2 answers
849 views

How to replace Lodash's _.countBy with only ES6?

Take the below array of arrays const data = [[150, 1], [300, 2], [430, 1]] With Lodash's countBy I could do _.countBy(row => row[1]) and it would return an object like so {"1": 2, "2&...
Blackfrwhite's user avatar
-3 votes
3 answers
42 views

Comparing arrays to get the list of values

I have a list of first arrays const a = [{id:1, value:'apple'}, {id:2, value: 'ball'},{id:3, value: 'cat'}] I have another array of ids const ids = [1,2] Now, I need to get the list of array values ...
Tripti Pant's user avatar
-2 votes
1 answer
70 views

How to get nested array item where object property id is "random" and change the name property

I have a nested array of objects. How to get nested array item where object property id is "random" and set name to "you won it" The structure looks like this: [ { itemsBundle [ { ...
user avatar

15 30 50 per page
1
2 3 4 5 6