fix(utils): remove hasProperty. Unused function

This commit is contained in:
Skillz4Killz
2022-05-28 13:28:11 +00:00
committed by GitHub
parent be51508245
commit 28974f2497
3 changed files with 1 additions and 35 deletions
-12
View File
@@ -13,15 +13,3 @@ export function delay(ms: number): Promise<void> {
export function formatImageURL(url: string, size: ImageSize = 128, format?: ImageFormat) {
return `${url}.${format || (url.includes("/a_") ? "gif" : "jpg")}?size=${size}`;
}
// Typescript is not so good as we developers so we need this little utility function to help it out
// Taken from https://fettblog.eu/typescript-hasownproperty/
/** TS save way to check if a property exists in an object */
// deno-lint-ignore ban-types
export function hasProperty<T extends {}, Y extends PropertyKey = string>(
obj: T,
prop: Y,
): obj is T & Record<Y, unknown> {
// deno-lint-ignore no-prototype-builtins
return obj.hasOwnProperty(prop);
}