All Questions
7 questions
1
vote
5
answers
496
views
Find unique array of objects dynamically considering undefined values
I have a an array of objects in this format:
const myArray = [
{
one: 'A',
two: 'AB'
},
{
one: undefined,
two: 'AB'
},
{
one: 'A',
two: 'BC'
},
{
one: undefined,
two: 'CC'
},
]
...
1
vote
2
answers
531
views
ReferenceError: _ is not defined on an array .map() call
I'm getting a "ReferenceError: _ is not defined" on a .map call like this:
arr.map(async (elem) => {
...
});
There doesn't appear to be any explicit mention of "_" anywhere ...
0
votes
1
answer
2k
views
Sorting alphanumeric field using lodash orderby
I am having problems sorting array of objects of this format
const arr = [
{ name: "test_1", age: 15 },
{ name: "test_11", age: 20 },
{ name: "test_12", age: 34 },
...
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 ...
1
vote
1
answer
1k
views
Trying to sort data inside a react table: Reactjs
I am trying to sort the table data based on the field selected from the dropdown. It should alternatively sort between ascending or descending whenever the same field is clicked. I am maintaining a ...
0
votes
1
answer
1k
views
Is there a way to check null or undefined in a series of object of objects in lodash [duplicate]
Let's consider a scenario in the below example, where I want to check the value of the object x.a.b or x.a.b.c, but it is throwing an exception while trying to access the object at second level (x.a.b)...
-2
votes
3
answers
693
views
How can I merge two objects of different lengths based on the values
I have two arrays of objects, both arrays containing key,value pair. my objective is to assign key value, from one array to the second array if the string value of one key name matches the string ...