增加一个数组toMap的方法, 修改remove为removeEx

This commit is contained in:
zhl 2021-01-29 18:37:01 +08:00
parent 0f719d4bd1
commit 8e3e16b194
3 changed files with 4 additions and 4 deletions

View File

@ -478,7 +478,7 @@ interface Array<T> {
* @returns {boolean} true * @returns {boolean} true
* false * false
*/ */
remove?(t: T): boolean; removeEx?(t: T): boolean;
/** /**
* *
@ -621,7 +621,7 @@ Object.defineProperties(Array.prototype, {
}, },
writable: true writable: true
}, },
remove: { removeEx: {
value: function <T>(this: T[], t: T) { value: function <T>(this: T[], t: T) {
let idx = this.indexOf(t); let idx = this.indexOf(t);
if (~idx) { if (~idx) {

View File

@ -83,7 +83,7 @@ export default class RecordController extends BaseController {
let smallTime = timeBeforeDay(30) let smallTime = timeBeforeDay(30)
for (let r of records) { for (let r of records) {
if (r.time < smallTime) { if (r.time < smallTime) {
records.remove(r) records.removeEx(r)
} }
} }
/** /**

View File

@ -140,7 +140,7 @@ class UserClass extends FindOrCreate {
let records = this.season_records || [] let records = this.season_records || []
for (let r of records) { for (let r of records) {
if (r.time < smallTime) { if (r.time < smallTime) {
records.remove(r) records.removeEx(r)
} }
} }
let win = 0 let win = 0