/*istanbul ignore next*/ function map( arr, mapper, that ) { if ( Array.prototype.map ) { return Array.prototype.map.call( arr, mapper, that ); } var other = new Array( arr.length ); for ( var i = 0, n = arr.length; i < n; i++ ) { other[ i ] = mapper.call( that, arr[ i ], i, arr ); } return other; }
var invokeGuardedCallbackImpl = function (name, func, context, a, b, c, d, e, f) { var funcArgs = Array.prototype.slice.call(arguments, 3); try { func.apply(context, funcArgs); } catch (error) { this.onError(error); } }
it('should have no triggers registered', done => { Parse.Hooks.getTriggers().then( res => { expect(res.constructor).toBe(Array.prototype.constructor); done(); }, err => { jfail(err); done(); } ); });
function sink (method, fn) { if (method === 'fatal') method = 'error' var orig = console[method] console[method] = function () { console[method] = orig fn(Array.prototype.slice.call(arguments)) } }
// Handle violation navigation function onLineNumberClick(e) { var line = document.getElementById("l" + e.target.textContent); if (line) { var highlighted = document.getElementsByClassName("highlight"); Array.prototype.forEach.call(highlighted, function forElement(element) { element.classList.remove("highlight"); }); line.classList.add("highlight"); line.scrollIntoView(); e.preventDefault(); } }
function init() { const ArrayProto = Array.prototype const SafeProto = SafeArray.prototype return { concat: unapply(SafeProto.concat), from: SafeArray.from, indexOf: unapply(ArrayProto.indexOf), join: unapply(ArrayProto.join), of: SafeArray.of, push: unapply(ArrayProto.push), unshift: unapply(ArrayProto.unshift) } }
describe(`for Array override`, () => { beforeEach(() => { Array.prototype.toPostgres = () => { return new MyType1(88); // testing recursive conversion; }; }); it(`must covert correctly`, () => { expect(pgp.as.format(`$1^`, [1, 2, 3])).toBe(`88.0000`); }); afterEach(() => { delete Array.prototype.toPostgres; }); });
// monkey-patch the array prototype because these are tests and IDGAF Object.defineProperty(Array.prototype, 'last', { value: function() { return this[this.length - 1] }, enumberable: false })
// Mimic commander syntax errors (with offsets) for consistency /* eslint-disable no-console */ const exitWithError = function () { const args = Array.prototype.slice.call(arguments); console.error(); console.error(...[" "].concat(args)); console.error(); process.exit(1); // eslint-disable-line no-process-exit }
/** * Converts the target object to an array. */ function toArray( o ) { return Array.prototype.slice.call( o ); }
it('should have no hooks registered', done => { Parse.Hooks.getFunctions().then( res => { expect(res.constructor).toBe(Array.prototype.constructor); done(); }, err => { jfail(err); done(); } ); });
// monkey-patch the array prototype because these are tests and IDGAF Object.defineProperty(Array.prototype, 'last', { value: function() { return this[this.length - 1] }, enumberable: false })
function slice(obj, index) { return Array.prototype.slice.call(obj, index); }
function slice(obj, index) { return Array.prototype.slice.call(obj, index); }
// turns Function.arguments into an array function simpleArguments( args ) { return Array.prototype.slice.call( args ); }