stack service and trigger service
This commit is contained in:
parent
1ed6449ac6
commit
cba12be4b1
16 changed files with 784 additions and 177 deletions
31
server/src/core/extensions/array.ts
Normal file
31
server/src/core/extensions/array.ts
Normal file
|
@ -0,0 +1,31 @@
|
|||
export {};
|
||||
|
||||
declare global {
|
||||
interface Array<T> {
|
||||
// @strict: The parameter is determined whether the arrays must be exactly the same in content and order of this relationship or simply follow the same requirements.
|
||||
equals(array: Array<T>, strict: boolean): boolean;
|
||||
}
|
||||
}
|
||||
|
||||
export const ArrayEquals = () => {
|
||||
if ([].equals == undefined) {
|
||||
Array.prototype.equals = function (array, strict = true) {
|
||||
if (!array) return false;
|
||||
|
||||
if (arguments.length == 1) strict = true;
|
||||
|
||||
if (this.length != array.length) return false;
|
||||
|
||||
for (let i = 0; i < this.length; i++) {
|
||||
if (this[i] instanceof Array && array[i] instanceof Array) {
|
||||
if (!this[i].equals(array[i], strict)) return false;
|
||||
} else if (strict && this[i] != array[i]) {
|
||||
return false;
|
||||
} else if (!strict) {
|
||||
return this.sort().equals(array.sort(), true);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
};
|
||||
}
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue