mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-09 16:13:31 +01:00
* feat: add @discordjs/util * fix: builders test * refactor: make rest use lazy for ESM import * chore: make requested changes * Apply suggestions from code review Co-authored-by: Parbez <imranbarbhuiya.fsd@gmail.com> Co-authored-by: A. Román <kyradiscord@gmail.com> * chore: make requested changes and add tests * chore: regen lockfile * test: add type tests * chore: push missing files * chore: make requested changes * chore: update CI stuff * chore: fix lockfile * chore: make requested changes Co-authored-by: Parbez <imranbarbhuiya.fsd@gmail.com> Co-authored-by: A. Román <kyradiscord@gmail.com> Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
22 lines
611 B
TypeScript
22 lines
611 B
TypeScript
/**
|
|
* Represents a structure that can be checked against another
|
|
* given structure for equality
|
|
*
|
|
* @typeParam T - The type of object to compare the current object to
|
|
*/
|
|
export interface Equatable<T> {
|
|
/**
|
|
* Whether or not this is equal to another structure
|
|
*/
|
|
equals(other: T): boolean;
|
|
}
|
|
|
|
/**
|
|
* Indicates if an object is equatable or not.
|
|
*
|
|
* @param maybeEquatable - The object to check against
|
|
*/
|
|
export function isEquatable(maybeEquatable: unknown): maybeEquatable is Equatable<unknown> {
|
|
return maybeEquatable !== null && typeof maybeEquatable === 'object' && 'equals' in maybeEquatable;
|
|
}
|