@wppconnect/wa-js
Version:
WPPConnect/WA-JS is an open-source project with the aim of exporting functions from WhatsApp Web
68 lines (67 loc) • 2.18 kB
TypeScript
/*!
* Copyright 2021 WPPConnect Team
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { Stringable } from '../../types';
import { WritableProperties } from '../../util';
import { EventEmitter } from '../misc';
interface Option {
add: boolean;
merge: boolean;
remove: boolean;
}
/** @whatsapp 31727
* @whatsapp 631727 >= 2.2222.8
*/
export declare interface Collection<M> extends EventEmitter, Pick<Array<M>, 'indexOf' | 'lastIndexOf' | 'every' | 'some' | 'forEach' | 'map' | 'filter' | 'reduce' | 'slice'> {
}
/** @whatsapp 31727
* @whatsapp 631727 >= 2.2222.8
*/
export declare class Collection<M, A = M | M[]> extends EventEmitter {
static model: any;
static comparator: (a: any, b: any) => number;
modelClass: M;
constructor(e?: any, t?: {
parent: any;
});
get length(): number;
add(value: A | WritableProperties<A>, options?: Option): A;
set(value: A, options?: Option): A;
remove(value: A, options?: {
index?: boolean;
silent?: boolean;
}): M[];
reset(): void;
sort(options?: {
silent?: boolean;
}): this;
replaceId(e: any, t: any): void;
reorderMutate(e: any, t: any): void;
get(e: Stringable): M | undefined;
assertGet(e: Stringable): M;
at(position: number): M | undefined;
serialize(): any[];
toJSON(): any[];
isModel(model: any): model is M;
includes(model: M, position?: number): boolean;
findFirst: Array<M>['find'];
where(ids: Stringable[]): M[];
head(): M | undefined;
last(): M | undefined;
toArray(): M[];
getModelsArray(): M[];
reorder(e: number, t: number): M[];
}
export {};