69e4072f89
* master: (389 commits)
Document "No gems fetched from git repositories" policy [ci skip]
Typos
Small gramatical tweaks
Typos
Added PHP & NPM doc
Use `:empty_project` where possible in request specs
Add caching of droplab ajax requests
Use `:empty_project` where possible in model specs
Revert 3f17f29a
Remove unused js response from refs controller
Add MR id to changelog entry
fixed small mini pipeline graph line glitch
Prevent form to be submitted twice
Fix Error 500 when repositories contain annotated tags pointing to blobs
Fix /explore sorting (trending)
Simplify wording in "adding an image" docs
Remove "official merge window" from CONTRIBUTING.md [ci skip]
Update repository check documentation
Fixed flexbox and wrap issues
Update two_factor_authentication.md
...
27 lines
747 B
JavaScript
27 lines
747 B
JavaScript
/* eslint-disable no-extend-native, func-names, space-before-function-paren, space-infix-ops, strict, max-len */
|
|
|
|
'use strict';
|
|
|
|
Array.prototype.first = function() {
|
|
return this[0];
|
|
};
|
|
|
|
Array.prototype.last = function() {
|
|
return this[this.length-1];
|
|
};
|
|
|
|
Array.prototype.find = Array.prototype.find || function(predicate, ...args) {
|
|
if (!this) throw new TypeError('Array.prototype.find called on null or undefined');
|
|
if (typeof predicate !== 'function') throw new TypeError('predicate must be a function');
|
|
|
|
const list = Object(this);
|
|
const thisArg = args[1];
|
|
let value = {};
|
|
|
|
for (let i = 0; i < list.length; i += 1) {
|
|
value = list[i];
|
|
if (predicate.call(thisArg, value, i, list)) return value;
|
|
}
|
|
|
|
return undefined;
|
|
};
|