@thefourtheye If you have already verified that iterable is a null, why are you checking its class with Object..toString? Just throw new TypeError('null object is not iterable') instead?
@thefourtheye the "correct" way would probably be to verify that it is not one of the 6 primitives. Also, strings are primitive but have a [Symbol.iterator] :P
@AwalGarg Hmmm, @loganfsmyth is the one who is helping me with this. And again, generators are objects only. So, Object(iterable) === iterable will be true for them as well.
It's a erm, function like? It has .call and .apply
In short, you're not really supposed to use it that way - the spec makes no guarantees (although I only read that part long ago in 2014) and that makes sense anyway since you shouldn't type check at all here.
@Esailija by the way, regarding iterators - I do think it could be interesting to deal with them. Wouldn't keeping it open and having a pr-welcome label be beneficial?
@Esailija yes, if you have coroutines you don't really need any of the helpers - so there's that. With coroutines or async functions - promises don't even have to be monadic - it might as well not even chain.
@Esailija I'm talking about it as an optimization.
Although I admit it's a lot of work for something that's not that big of a deal. The only bluebird features I use often with babel is debugging and performance.
They can but they don't. They use UIWebView and not UIWebkitView
@Esailija I don't, but a lot of people apparently do - we had to do a lot of work to get it to run. Also - you don't have dev tools there or a debugger.
We ended up tuning our app for like 2 weeks and now it's super fast - turns out it was fast to begin with and the problem is Azure (600ms to serve a static file). So now we have like 400ms load lol.
I had someone lecture me on how awesome and stable node is the other day by the day. Ended up sending him the __proto__ trick in an object and watched his app crash. That was hilarious.
Angular 1 basically doesn't have good DI at all (it does have easy DI) - it's mostly surprising because Misko is one of the biggest DI advocates out there.
DI is about configuration in how a module gets its dependencies - it's moving creation to outside the piece of code and making it possible to configure code.
So, for example, you can configure logging to work differently in different pieces of code - or can configure some parts of the code to pool DB connections and another to not.
You can configure different priorities in outbound http requests and propagate those dependencies with DI.
It's not just "to make testing easy", testing is super easy in JS anyway - it's a dynamic language you can swap out anything anyway. You can do testing just as easily with a service locator.
DI has a nice mental model (every object created is explicit about what it needs) - but it's not about testing. Testing is like 20% of why it's useful.
Testing doesn't actually exploit the usefulness of DI very much. It's useful there since you have to know what to swap out since dependencies are explicit - but that's an artifact of DI being useful - not its core value IMO.
I'm a big advocate of understanding the problem you're solving before attempting to solve it. I think there is a cultural and education problem with Angular 1 devs.