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
16 lines (15 loc) • 566 B
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var getCurrentDocument_1 = __importDefault(require("./getCurrentDocument"));
var isWindow_1 = __importDefault(require("./isWindow"));
function getCurrentWindow(obj) {
if (isWindow_1.default(obj)) {
return obj;
}
var doc = getCurrentDocument_1.default(obj);
return doc && doc.defaultView;
}
exports.default = getCurrentWindow;