JavaScript Converting an array of objects to Map Immutable.js convert array objects to json,convert array objects to string,

I have an array of objects which I wish to convert into a plain Immutable map of:

name: {
  urlname
  id
}

Currently I am doing the following data being the array of objects:

data = data.map((data) => ({
  name: data.name,
  urlName: data.urlName,
  id: data.id
}))

What I am trying to transform is the following (data):

[{"id":"10","name":"Dave","urlName":"foo-bar","order":"-100","classId":"12","className":"David","classUrlName":"david-foo-bar"}]

As said above, I would like the name as the key, and both the urlName and the id as values to the key if possible. I would like to loop around data until everything is reduced to that structure if possible.

Answer:1

I want to disable and replace the vertical scroll with horizontal one in Vanilla JavaScript. I am blocked when I try to replace my scroll values. I trust there is a simple simple (really simple) ...

I want to disable and replace the vertical scroll with horizontal one in Vanilla JavaScript. I am blocked when I try to replace my scroll values. I trust there is a simple simple (really simple) ...

I'm using https://www.npmjs.com/package/mqtt with React. In my component I have: componentDidMount:function(){ client.subscribe('test/topic'); client.on('message',function(topic,...

I'm using https://www.npmjs.com/package/mqtt with React. In my component I have: componentDidMount:function(){ client.subscribe('test/topic'); client.on('message',function(topic,...

  1. react mqtt subscribe

In JavaScript, I am running a forEch method on an array of objects. Would like to run through my JSON and replace a substring in a string with a new string if the condition is met. The issue is this:...

In JavaScript, I am running a forEch method on an array of objects. Would like to run through my JSON and replace a substring in a string with a new string if the condition is met. The issue is this:...

I have a string like this : var name="C:\Users\Desktop\task.txt"; I want to get the last index of backslash in the above string. How to do it ?

I have a string like this : var name="C:\Users\Desktop\task.txt"; I want to get the last index of backslash in the above string. How to do it ?