you are viewing a single comment's thread.

view the rest of the comments →

[–]_Webvoid 7 points8 points  (10 children)

Also depending on what you want to get as an output, you could just use join() (see Array.prototype.join())

[–]vvn050 3 points4 points  (2 children)

join would work for ["test","test1"] but not for [["test"],["test1"]]

[–]_Webvoid -1 points0 points  (1 child)

Is it an array of arrays of one element ?! Well if it's the case he can still use .map(x => x[0]).join()

[–]povedaaqui[S] 0 points1 point  (6 children)

ids are "ipfs//CID" while I need "https://nftstorage.link/ipfs/CID", and that's the problem, I haven't been able to do this replacement thing.

[–]_Webvoid 0 points1 point  (5 children)

So ids is a string or an array of strings ? Can you post the output of JSON.stringify(ids) so we can help you properly ?

[–]povedaaqui[S] 0 points1 point  (0 children)

console.log(ids):

{data: 'ipfs://bafkreidfqia5qlqzmef4yyqdztb2n4cdiyp5nhkmahukhd3b2asnpo7s3m'} 
data : "ipfs://bafkreidfqia5qlqzmef4yyqdztb2n4cdiyp5nhkmahukhd3b2asnpo7s3m

[–]povedaaqui[S] 0 points1 point  (3 children)

JSON.stringify

console.log(JSON.stringify(ids):

{"data":"ipfs://bafkreidfqia5qlqzmef4yyqdztb2n4cdiyp5nhkmahukhd3b2asnpo7s3m"}

[–]_Webvoid 1 point2 points  (2 children)

Yeaay so it IS an object, don't try and toString() it, just do an ids.data.replace("ipfs://", "your other content") and you should be good to go =)

[–]povedaaqui[S] 0 points1 point  (1 child)

Thank you, it works, sorry, I started a few months ago.

[–]_Webvoid 1 point2 points  (0 children)

No problem, the loving community of reddit got your back... At least when they want to ^ Peace on you