Coder Social home page Coder Social logo

forEach polyfil about cell HOT 3 CLOSED

intercellular avatar intercellular commented on June 10, 2024 1
forEach polyfil

from cell.

Comments (3)

gliechtenstein avatar gliechtenstein commented on June 10, 2024

Thanks for pointing out. The Array.prototype.forEach option was actually what I've been using throughout 99% of the development process before I released the library to public.

The reason I switched it at the last moment was because so many people online keep saying this is a bad pattern (although I don't agree entirely) and I didn't want to worry too much about this so just decided to go with the polyfill I found on MDN (I mean it's MDN, so gotta be alright, right? :) )

BUT, I honestly don't think they will make a big difference and prefer your Array.prototype.forEach option over the MDN one since I want to keep the code as short as possible.

If anyone has thoughts on this or think I'm missing something, please jump in and share. I'm almost leaning towards using this Array.prototype.forEach solution.

from cell.

fprijate avatar fprijate commented on June 10, 2024

Hi

I am aware of MDN polyfil
IMO it's intended for older browsers which don't implement functional Array methods (map, filter, forEach, ...).
We use map method in few places.
We should polyfill map and other Array methods to in this case.
All modern browsers implement them natively (except Edge misses Nodelist.forEach).
So your solution is sane.
Anyone who is fan of ancient browsers can anyhow use some polyfill library.

from cell.

gliechtenstein avatar gliechtenstein commented on June 10, 2024

Thanks for the suggestion, we finally incorporated this with b4751fc

Now it's just a one-liner! https://github.com/intercellular/cell/blob/develop/cell.js#L376

from cell.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.