doing things that make me feel gross

(it's

let i = 0;
for (; i<matches[0].length; i++) {
const idx = i + currentSignal.length;
if (matches[0][idx] !== matches[matches.length-1][idx]) break;
}

)

@monorail I think a while loop would be better but I'm not sure I would give enough of a shit in a code review because either way would look Weird

@monorail here's my final answer:

let i = 0;
for (
let idx = currentSignal.length;
i < matches[0].length && matches[0][idx] === matches.at(-1)[idx];
idx += i++
);

@wallhackio @monorail idx should increment by 1 which is not what either of those would do

Follow

@vaporeon_ @aescling @monorail yeah that's what i would do (actually I would do ++idx, ++i but it objectively doesn't matter)

@vaporeon_ @aescling @monorail also this thread makes me certain that "I'm not sure I would give enough of a shit in a code review because either way would look Weird" was the right answer all along

@wallhackio @vaporeon_ @aescling sometimes you have an iife that constructs a script tag and injects it into the DOM, that's also conventional (but not always necessary)

@monorail @vaporeon_ @aescling I will support iife usage even if its stupid, iifes give me life

@wallhackio @vaporeon_ @aescling it makes sense for userscripts because they like to pretend they live in their own little bubble but you absolutely can pollute the global namespace with them and cause big bad problems

@monorail @vaporeon_ @aescling my only note is to use matches.at(-1) instead of matches[matches.length-1] at line 53 but even so, your javascript is clod-approved :clodsire_head::clodsire_tail:

Sign in to participate in the conversation
📟🐱 GlitchCat

A small, community‐oriented Mastodon‐compatible Fediverse (GlitchSoc) instance managed as a joint venture between the cat and KIBI families.