webstudio/ui/src/core/extensions/extensions.ts
2024-01-23 17:23:10 +03:00

29 lines
940 B
TypeScript

import { ArrayExtensions } from "./array";
import { MapExtensions } from "./map";
import { StringExtensions } from "./string";
export type CallBackVoidFunction = <T>(value: T) => void;
export type CallBackStringVoidFunction = (value: string) => void;
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;
lastElement(): T | undefined;
isEmpty(): boolean;
isNotEmpty(): boolean;
hasIncludeElement(element: T): boolean;
}
interface String {
isEmpty(): boolean;
isNotEmpty(): boolean;
}
interface Map<K, V> {
addValueOrMakeCallback(key: K, value: V, callBack: CallBackVoidFunction): void;
}
}
export const extensions = () => {
ArrayExtensions();
StringExtensions();
MapExtensions();
};