Comparing version 0.2.1 to 0.3.0
@@ -8,20 +8,52 @@ "use strict"; | ||
//@ts-check | ||
var defaultObj = { | ||
__null: true | ||
}; | ||
/** | ||
* @param {object|undefined} w | ||
* @param {object} def | ||
* @returns {object} | ||
*/ | ||
var doc = function doc(w, def) { | ||
if (w === void 0) { | ||
w = _reshowConstant.T_UNDEFINED; | ||
} | ||
if (def === void 0) { | ||
def = defaultObj; | ||
} | ||
var oDoc = (w || win()).document; | ||
return _reshowConstant.UNDEFINED !== typeof oDoc ? oDoc : def || defaultObj; | ||
return _reshowConstant.UNDEFINED !== typeof oDoc ? oDoc : def; | ||
}; | ||
/** | ||
* @param {string} key | ||
* @returns {boolean} | ||
*/ | ||
exports.doc = doc; | ||
var hasWin = function hasWin(key) { | ||
return !win()[key || "__null"]; | ||
if (key === void 0) { | ||
key = "__null"; | ||
} | ||
return !win()[key]; | ||
}; | ||
/** | ||
* @param {object} def | ||
* @returns {object} | ||
*/ | ||
exports.hasWin = hasWin; | ||
var win = function win(def) { | ||
if (def === void 0) { | ||
def = defaultObj; | ||
} | ||
return ( | ||
@@ -32,3 +64,3 @@ /** | ||
*/ | ||
"undefined" !== typeof window ? window : def || defaultObj | ||
"undefined" !== typeof window ? window : def | ||
); | ||
@@ -35,0 +67,0 @@ }; |
{ | ||
"version": "0.2.1", | ||
"version": "0.3.0", | ||
"name": "win-doc", | ||
@@ -31,3 +31,4 @@ "repository": { | ||
"build:es": "BABEL_ENV=es babel src -d build/es/src --out-file-extension .mjs --root-mode upward", | ||
"build": "npm run clean && npm run build:cjs && npm run build:es", | ||
"build:type": "npx -p typescript tsc src/*.js --declaration --allowJs --emitDeclarationOnly --skipLibCheck --declarationDir types", | ||
"build": "npm run clean && npm run build:cjs && npm run build:es && npm run build:type", | ||
"mochaFor": "mocha -r global-jsdom/register", | ||
@@ -38,3 +39,5 @@ "mocha": "npm run mochaFor -- 'build/es/**/__tests__/*.mjs'", | ||
}, | ||
"types": "./types/index.d.ts", | ||
"files": [ | ||
"types", | ||
"build", | ||
@@ -41,0 +44,0 @@ "package.json", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
5291
7
163