Skip to content

function _curryHandler(boundArgs) {
  return {
    apply: function (target, thisArg, argList) {
      var totalArgs = boundArgs.concat(argList);
      return totalArgs.length >= target.length ? target.apply(thisArg, totalArgs) : new Proxy(target, _curryHandler(totalArgs));
    get: function (target, prop, recv) {
View cloneAsync.js
var cloneAsync = (function() {
var queue = [];
var worker = new Worker(URL.createObjectURL(new Blob(['onmessage=function(e){postMessage(}'], {
'type': 'text/javascript'
worker.addEventListener('message', function listener(e) {
var callback = queue.shift().callback;
if (queue.length) {
View Function.prototype.arity.js
// 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
View gist:1120592

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

View gist:812950
  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 couldn't find that file to show.
View gist:70427
var BackgroundIteration = Class.create({
initialize: function(iterator, produceNextValue) {
this.iterator = iterator;
this.produceNextValue = produceNextValue;
this.callbacks = [];
this.results = []; =;;
View gist:12375
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;
Something went wrong with that request. Please try again.