deleted unnecessary files

added new features
This commit is contained in:
IDONTSUDO 2024-04-09 16:31:25 +03:00
parent dffc73c30f
commit 6840402b1f
119 changed files with 1835 additions and 1522 deletions

View file

@ -26,6 +26,9 @@ declare global {
interface String {
isEmpty(): boolean;
isNotEmpty(): boolean;
replaceMany(searchValues: string[], replaceValue: string): string;
isEqual(str: string): boolean;
isEqualMany(str: string[]): boolean;
}
interface Map<K, V> {
addValueOrMakeCallback(key: K, value: V, callBack: CallBackVoidFunction): void;
@ -37,8 +40,8 @@ declare global {
}
}
export const extensions = () => {
ArrayExtensions();
StringExtensions();
ArrayExtensions();
NumberExtensions();
MapExtensions();
};

View file

@ -1,3 +1,4 @@
/* eslint-disable no-extend-native */
export const StringExtensions = () => {
if ("".isEmpty === undefined) {
// eslint-disable-next-line no-extend-native
@ -11,4 +12,28 @@ export const StringExtensions = () => {
return this.length !== 0;
};
}
if ("".replaceMany === undefined) {
String.prototype.replaceMany = function (searchValues: string[], replaceValue: string) {
let result = this as string;
searchValues.forEach((el) => {
result = result.replaceAll(el, replaceValue);
});
return result;
};
}
if ("".isEqual === undefined) {
String.prototype.isEqual = function (str: string) {
return this === str;
};
}
if ("".isEqualMany === undefined) {
String.prototype.isEqualMany = function (str: string[]) {
for (const el of str) {
if (el === this) {
return true;
}
}
return false;
};
}
};