UNPKG

vanillajs-browser-helpers

Version:

Collection of convenience code snippets (helpers) that aims to make it a little easier to work with vanilla JS in the browser

14 lines (10 loc) 325 B
import type { GeneralWindow } from './shared/types'; /** * Is the given object a Window object * * @param obj - The object to check * @return Is it a Window object or not */ export default function isWindow(obj: unknown): obj is GeneralWindow { return !!obj && typeof (obj as GeneralWindow).self !== 'undefined'; }