Skip to main content

All Questions

4 votes
3 answers
89 views

How to tell where an object value is undefined?

Below have I a very simple function, which I type check at compile and runtime, but I would to also rumtime check all the keys result in a value, and if it doesn't, then prompt where it broke. The ...
Sandra Schlichting's user avatar
0 votes
4 answers
1k views

NodeJS deep nested json comparison case insensitive key/value pair

I want to compare two nested json in NodeJS, json key position can change and also key/value comparison should bee case insensitive I'm using deep-equal NodeJS module, but it's only working for case ...
Dev's user avatar
  • 423
3 votes
2 answers
211 views

reduce es6 missing nested array of object using spread

I've got a problem merging 2 sets of data by a condition. I've debugged for more than an hour but couldn't figure out why. I've created a sample below. I have these 2 data: const staticRockData = { ...
Hanz's user avatar
  • 529
0 votes
2 answers
774 views

How to replace or append object to another object using Lodash

I have 2 objects { "Simon": { "occupation": "garbage man", "age": "21" } } and this one { "wife": "Kate" } How will I insert the second object to the first object to ...
The Bassman's user avatar
  • 2,361
1 vote
1 answer
942 views

Object Destructuring

How can I write this code in more elegant way. I have looked on lodash etc. but couldn't actually find the best way to destructure object for my needs. Because I will write those properties on mongo I ...
suchcodemuchwow's user avatar
0 votes
1 answer
53 views

How to prototype function in diferent context

I have function where i pass another 2 functions as parameters, something like: doSomething(func1,func2) What i need is to prototype the func1 in other context when the function is being exported. ...
El Capiton's user avatar
-1 votes
8 answers
267 views

merge array in deep array nodejs

I have the following structure: const array = [ [ [ [ [ { 'name':'John' } ], { 'name':'Mary' } ], { ...
aloebys's user avatar
  • 123
32 votes
4 answers
30k views

How to add mixins to ES6 javascript classes?

In an ES6 class with some instance variables and methods, how can you add a mixin to it? I've given an example below, though I don't know if the syntax for the mixin object is correct. class Test { ...
user779159's user avatar
  • 9,632
1 vote
2 answers
2k views

lodash _.remove not working on an object content

I can't have lodash _.remove to work in an object content that looks like this content: { code: '8d303377', type: 'content', repositoryCode: 'default', externalLocations: { binaries: ...
kyserslick's user avatar
3 votes
4 answers
295 views

run for random numbers and keep state [duplicate]

I use the following code to get random value from specifed range var provideRanges = function(){ var aa = []; _.times(3, function(i) { console.log(i); let num = _.random(10, 20) ...
John Jerrby's user avatar
  • 1,703
-1 votes
2 answers
568 views

Exclude given objects from array

I have the below array. I am attempting to exclude certain objects from this array in processing. For example. I would like to exclude the type 'dog' and only use any object that is of type duck. I'...
WeeniehuahuaXD's user avatar