Skip to content
var cloneAsync = (function() {
var queue = [];
var worker = new Worker(URL.createObjectURL(new Blob(['onmessage=function(e){postMessage(e.data)}'], {
'type': 'text/javascript'
})));
worker.addEventListener('message', function listener(e) {
var callback = queue.shift().callback;
if (queue.length) {
// This is just a simple proof of concept. There are other things needed to make this more robust,
// like checks to ensure function decompilation is supported, stripping comments from the heading,
// better default param and rest detection, etc.
if (Object.defineProperty && typeof WeakMap == 'function') {
Object.defineProperty(Function.prototype, 'arity', (function() {
var fnToString = Function.prototype.toString,
map = new WeakMap,
reDefaultAndRest = /=|\.\.\./g,
reHeading = /^[^{]+/;
node ../lodash-cli/bin/lodash modularize modern exports=amd -o ./ && node ../lodash-cli/bin/lodash modern exports=amd -d -o ./main.js
node ../lodash-cli/bin/lodash modularize compat exports=amd -o ./ && node ../lodash-cli/bin/lodash compat exports=amd -d -o ./main.js

Incorrect ES5 fallbacks

Over the weekend I implemented a few Array methods in plain JavaScript to avoid recently patched Rhino bugs. That got my thinking about ES5 fallback implementations in various JavaScript libs/frameworks/transpilers. I decided to compile a not-so-complete list of ES5 related discrepancies found in many of them. Differences in native vs. fallback implementations create cross-browser inconsistencies and increase the chance of usage errors. I hope this post will raise awareness of just how hard it is to follow spec (during my research I found a few issues in my own projects too). All library developers should to take a closer look at their code and make the small changes needed to follow the specification (especially if your code forks for native methods).

Common Issues

Most implementations suffer from the following

  1. Feature Testing

    Check for the existence of a method and checks that it returns the correct output

  2. Feature Detection

    Check for the existence of a method

  3. Weak Inference

We couldn't find that file to show.
We're sorry, but we could not retrieve that file for display.
var BackgroundIteration = Class.create({
initialize: function(iterator, produceNextValue) {
this.iterator = iterator;
this.produceNextValue = produceNextValue;
this.callbacks = [];
this.results = [];
this.next = this.next.bind(this);
this.next.defer();
},
Date.prototype.format = (function() {
var padded = 'd=Date&m=Month&H=Hours&M=Minutes&S=Seconds'.toQueryParams(),
regular = 'Y=FullYear&f=Date&F=Month'.toQueryParams();
return function(format) {
var d = this;
return format.gsub(/%([CdFfHMmnRSTYy%])/, function(match) {
match = match[1];
var method, offset = /m|F/.test(match) ? 1 : 0;
function isLesserVersion() {
var args = Array.prototype.slice.call(arguments, 0)
.map(function(a) { return a.toString().replace(/[^\d.]/g, '').split('.') });
var max = Math.max(args[0].length, args[1].length),
pad = '0'.times(max).split('');
args = args.map(function(a) { return a.concat(pad).slice(0, max) });
for (var i = 0, v; v = args[0][i]; i++) {
if (v == args[1][i]) continue;
Something went wrong with that request. Please try again.