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

10 lines (9 loc) 276 B
import getCurrentDocument from './getCurrentDocument'; import isWindow from './isWindow'; export default function getCurrentWindow(obj) { if (isWindow(obj)) { return obj; } const doc = getCurrentDocument(obj); return doc && doc.defaultView; }