All Questions
30
questions
0
votes
1
answer
39
views
How to Combine Same key JavaScript Object to one Array Dynamically
How to Combine Same key JavaScript Object to one Array Dynamically in JavaScript/Nodejs and Produce given Input to expected output,
Please do help me on this. that would be really helpful.
Example -
[
...
0
votes
1
answer
288
views
Append string using regex at the end of URL values inside the nested object on Node.js
Sample object (the below object is a very large nested object):
const obj = { a: 1, url: "https://someurl.com", b: { c: 1, d: { otherUrl: "https://someotherurl.com"}};
I want to ...
1
vote
2
answers
93
views
JavaScript ES6+ compare fields in arrays of objects
Spinning my wheels here. Seems simple conceptually but JS is trying to kill me.
Two arrays of objects:
let allProfileUsers = [
{
id: "0b4cd920-31da-11ec-a31c-cd844bfb73be",
...
0
votes
1
answer
69
views
Create array of objects from another array of objects
(Sorry for the title)
What is the best way to turn this:
[
{
directory: 'video_0',
files: [ 'comp_0.mp4', 'comp_1.mp4' ],
uploadedFiles: ['video_0/comp_0.mp4','video_0/comp_1.mp4'...
1
vote
3
answers
995
views
Capitalize values of destructed object
i have destructered req.body into:
const {
logo = randomImg,
category,
name,
owner,
phone = "NA",
location = "NA",
website = "NA"...
0
votes
1
answer
2k
views
how to create a destructor in es6
For example:
function a() {
this.heartbeat = setInterval(()=>{}, 10000)
}
var b = new a()
delete b //The heartbeat still seems to be working
I want to remove the heartbeat when my object is ...
0
votes
3
answers
187
views
Remove empty objects, arrays, strings or integers from an object
I have the following snippet that is not working and decided to isolate it into a nodejs script:
const _ = require('lodash');
let derpObject = {
foo: "hey",
bar: "",
foo2: [],
bar2: {...
2
votes
3
answers
89
views
Can't access function after name changed in node.js
There is a function in one of my files in project which I changed it's name and can't access it with new name! still the old name is available to call
I tried deleting node_modules and install it ...
1
vote
0
answers
347
views
How to convert dotted property names into a structured nested object in JavaScript? [duplicate]
I have an object in this form:
{
list: '1',
'filter.dealStatus': 'Accepted',
'filter.type': 'longTerm'
}
Is there an easy way to convert this into a structured object where the dotted ...
0
votes
2
answers
82
views
Iterating an array of items in nodejs
I have an index.js from which I am calling util.js as below :
util.js
module.exports.getResult = json => {
return json.hits.hits.map(element => {
const { _source } = element;
return ...
0
votes
1
answer
123
views
Unpack object inside {}
I was using an API endpoint which returned an iterator object, but with the latest change, now it returns it inside {}.
previous:
return iterator
Current
return {iterator}
How can I unpack it in ...
1
vote
4
answers
87
views
Is it possible to make an already initialised object literal an instance of a defined class?
I would like to know if it is possible to make an already initialised object literal into an instance of an already defined class.
class ParentClass {
bye () { console.log("Bye!"); }
}
class ...
1
vote
2
answers
628
views
NodeJS double negate ternary operator
I am using ternary operator in NodeJS below shown
let err = {a: 10, message: 0}
const error = !!err.message ? err.message : err;
But above code is showing eslint error for double negation how to ...
1
vote
2
answers
1k
views
How to insert array into a column in spanner database using javascript es6
I have the following data:
data = {
id: 10012,
name: "abc",
hobby: ["cricket", "football"]
}
My table structure is:
id int64,
name string(25),
petName string(20),
hobby string(25)
How ...
0
votes
1
answer
61
views
Javascript ES6 - is it possible to use/call super class properties or functions without using this keyword in child class [duplicate]
Javascript ES6 - is it possible to use/call super class properties or functions without using this keyword in child class
class Parent {
constructor() {
this.strings = 'some ...