The issue is that, in the function passed to reduce
, you’re adding each object directly to the accumulator rather than to its intended parent. These are the problem lines:
if (index == array.length - 1) {
accumulator[val] = value;
} else if (!accumulator.hasOwnProperty(val)) {
accumulator[val] = {}; // update the accumulator object
}
There’s no pretty way (that I can think of at least) to do what you want using methods like reduce
in vanilla JS, so I’d suggest using a for loop instead - especially if you’re new to programming. Something along these lines (not written to be actual code, just to give you an idea):
let curr = settings;
const split = url.split("/");
for (let i = 0; i < split.length: i++) {
const val = split[i];
if (i != split.length-1) {
//add a check to see if curr[val] exists
let next = {};
curr[val] = next;
curr = next;
}
//add else branch
}
It’s missing some things, but the important part is there - every time we move one level deeper in the URL, we update curr
so that we keep our place instead of always adding to the top level.
I’ve found it depends a lot on the game. In CP2077, DLSS+frame gen looks great to me with full raytracing enabled. But in The Witcher 3, I found frame gen to cause a lot of artifacts, and in PvP games I wouldn’t use regular DLSS/FSR. In general I’ve found the quality preset in DLSS to be mostly indistinguishable from native on 3440x1440, and I’m excited to try FSR 3 when I get the chance.