pasture,
@pasture@btrfly.social avatar

Corpobrained retard. How about you stop downloading an npm package to pad a string

pasture,
@pasture@btrfly.social avatar

function leftPad(str, len){
while(str.length < len) str=" "+str
return str
}

JavaScript developer's worst nightmare

7,
@7@gh0st.live avatar

@pasture > a helper function that doesn't mutate its arguments and returns a value

I don't even think JS developers could fathom, let alone have nightmares about it

pasture,
@pasture@btrfly.social avatar

Need a wrapper around the left-pad API, this is way too complicated for a lowly developer like me

async function leftPad(str, len){
try {
return (await (await fetch("https://left-pad.com/?str=" + encodeURIComponent(str) + "&len=" + len)).json()).result;
} catch(e) throw e;
}

That'll be $6 gorillion per year please

  • All
  • Subscribed
  • Moderated
  • Favorites
  • random
  • Hentai
  • doujinshi
  • announcements
  • general
  • All magazines