matthewrobb
12/6/2017 - 6:56 PM

free-fn.js

'use strict';

export function free(fn) {
  return function() {
    return this === undefined ? fn.apply(undefined, arguments) : fn.call(undefined, this, ...arguments);
  }
}

export function freeRight(fn) {
  return function() {
    return this === undefined ? fn.apply(undefined, arguments) : fn.call(undefined, ...arguments, this);
  }
}