2018-01-10 12:58:58 +00:00
|
|
|
/**
|
|
|
|
* 补丁和方法扩展
|
|
|
|
*/
|
2019-03-13 09:27:17 +00:00
|
|
|
(function() {
|
2018-05-17 10:30:40 +00:00
|
|
|
// noinspection JSUnresolvedVariable
|
2018-01-10 12:58:58 +00:00
|
|
|
if (!Array.prototype.copyPartialMatches) {
|
|
|
|
Object.defineProperty(Array.prototype, "copyPartialMatches", {
|
|
|
|
enumerable: false,
|
2019-03-13 09:27:17 +00:00
|
|
|
value: function(token, array) {
|
|
|
|
if (!token) { return this }
|
|
|
|
this.forEach(function(e) {
|
|
|
|
if (typeof e === "string" && e.toLowerCase().startsWith(token.toLowerCase())) {
|
2018-01-10 12:58:58 +00:00
|
|
|
array.push(e)
|
|
|
|
}
|
2018-05-17 10:30:40 +00:00
|
|
|
});
|
2018-01-10 12:58:58 +00:00
|
|
|
return array
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
2019-04-28 10:06:42 +00:00
|
|
|
})();
|