split-keypath
Version:
Splits strings into an array of keys used for reading nested data structures
20 lines (16 loc) • 514 B
JavaScript
/**
* Function bind polyfill
* https://github.com/ariya/phantomjs/issues/10522
*/
if (!Function.prototype.bind) {
Function.prototype.bind = function (context /* ...args */) {
var fn = this;
var args = Array.prototype.slice.call(arguments, 1);
if (typeof(fn) !== 'function') {
throw new TypeError('Function.prototype.bind - context must be a valid function');
}
return function () {
return fn.apply(context, args.concat(Array.prototype.slice.call(arguments)));
};
};
}