5 ms·
>I wrote a lib to fix the bug. https://www.npmjs.com/package/array-reverse-polyfill https://www.npmjs.com/package/array-reverse-polyfill everyday we stray furt
by matkinz 8y ago
>I wrote a lib to fix the bug. https://www.npmjs.com/package/array-reverse-polyfill https://www.npmjs.com/package/array-reverse-polyfill
everyday we stray further from god
- realPubkey 8y agoAlso if now everyone starts to polyfill this garbage, then apple will not patch it before the next release of iOS.
- vanderZwan 8y agoWhat is extra frustrating is that this is an answer StackOverflow. The whole point is to give clear, educational explanations. Well, the solution is only 21 lines, so why not explain the code snippet instead? (function() { function buggy() { function detect() { var a = [0, 1]; a.reverse(); return a[0] === 0; } return detect() || detect(); } if(!buggy()) return; Array.prototype._reverse = Array.prototype.reverse; Array.prototype.reverse = function reverse() { if (Array.isArray(this)) this.length = this.length; return Array.prototype._reverse.call(this); } var nonenum = {enumerable: false}; Object.defineProperties(Array.prototype, { _reverse: nonenum, reverse: nonenum, }); })(); Look at how elaborate the repo is by comparison: https://github.com/fanmingfei/array-reverse-ios12 https://github.com/fanmingfei/array-reverse-ios12
- masto 8y agoIt has a nice logo though I can't find a link to the merch store or author's Patreon.
- raverbashing 8y ago> answer StackOverflow ... the solution is only 21 lines, so why not explain the code snippet instead? You answered your own question. Especially in the JS world
- KyleDavidE 8y ago? The snippet you showed is literally the exact code of the module: https://github.com/fanmingfei/array-reverse-ios12/blob/master/index.js https://github.com/fanmingfei/array-reverse-ios12/blob/maste... The rest is just tests / npm config / license
- vanderZwan 8y agoWhen I posted this, the snippet was not part of the answer being discussed. There was only a link to a node module.
- jbreckmckye 8y agoI was so offended I raised an issue just to throw a strop: https://github.com/fanmingfei/array-reverse-ios12/issues/16 https://github.com/fanmingfei/array-reverse-ios12/issues/16