View gz.js
'use strict'
const fs = require('fs')
const path = require('path')
const zlib = require('zlib')
require.extensions['.gz'] =
require.extensions['.js.gz'] = (module, filename) => {
if (path.extname(filename.slice(0, -3)) === '.js') {
let content = zlib.unzipSync(fs.readFileSync(filename)).toString()

```js 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 exports=amd -o ./ && node ../lodash-cli/bin/lodash 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

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;
View gist:6824
function isLesserVersion() {
var args =, 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 = { return a.concat(pad).slice(0, max) });
for (var i = 0, v; v = args[0][i]; i++) {
if (v == args[1][i]) continue;