locomotivemtl / locomotive-boilerplate

🚂 Front-end boilerplate for projects by Locomotive.
https://locomotivemtl-boilerplate.vercel.app/
MIT License
458 stars 71 forks source link

ES6 Updates #120

Closed lucasvallenet closed 1 year ago

lucasvallenet commented 2 years ago

Clean-up utility functions:

I did not edit the visibility.js to avoid conflicts with PR#99

lucasvallenet commented 2 years ago

+1 for adding an ES linter warning on save/commit

lucasvallenet commented 2 years ago

I completely deleted the array.js util. They are almost never used and a single ES6 line is possible as an alternative :

addToArray new Set(array.push(value))

arrayContains array.includes(value)

lastItemOfArray array[array.length - 1]

removeFromArray array.filter(item => item !== value)

toArray Array.from(array)

findByKeyValue array.find(item => item[key] === value)

cloneArray [...array]

shuffleArray array.sort(() => 0.5 - Math.random())

lucasvallenet commented 2 years ago
arnvvd commented 1 year ago

Outcome from meeting on 2022-10-05 Status: Approved by all.

cloudflare-pages[bot] commented 1 year ago

Deploying with  Cloudflare Pages  Cloudflare Pages

Latest commit: a8314d0
Status: âœ…  Deploy successful!
Preview URL: https://48a15de3.locomotive-boilerplate.pages.dev
Branch Preview URL: https://feature-es6-updates.locomotive-boilerplate.pages.dev

View logs