@ideal-postcodes/jsutil
Advanced tools
Comparing version 4.3.8 to 4.3.9
@@ -0,1 +1,8 @@ | ||
## [4.3.9](https://github.com/ideal-postcodes/jsutil/compare/4.3.8...4.3.9) (2021-05-09) | ||
### Bug Fixes | ||
* **SSR:** Make JsUtil more compatible with SSR ([0344121](https://github.com/ideal-postcodes/jsutil/commit/03441216a72b9a176be5c5ed3bc8b772e2ea77da)) | ||
## [4.3.8](https://github.com/ideal-postcodes/jsutil/compare/4.3.7...4.3.8) (2021-04-23) | ||
@@ -2,0 +9,0 @@ |
import { ParentTest, SelectorNode } from "./types"; | ||
export declare const hasWindow: () => boolean; | ||
export declare const toArray: <T = HTMLElement>(nodeList: NodeList) => T[]; | ||
@@ -3,0 +4,0 @@ export declare const loaded: (elem: HTMLElement) => boolean; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.remove = exports.show = exports.hide = exports.restoreStyle = exports.setStyle = exports.getDocument = exports.getScope = exports.toElem = exports.insertBefore = exports.getAnchors = exports.toHtmlElem = exports.getParent = exports.markLoaded = exports.loaded = exports.toArray = void 0; | ||
exports.remove = exports.show = exports.hide = exports.restoreStyle = exports.setStyle = exports.getDocument = exports.getScope = exports.toElem = exports.insertBefore = exports.getAnchors = exports.toHtmlElem = exports.getParent = exports.markLoaded = exports.loaded = exports.toArray = exports.hasWindow = void 0; | ||
const string_1 = require("./string"); | ||
const hasWindow = () => typeof window !== "undefined"; | ||
exports.hasWindow = hasWindow; | ||
const toArray = (nodeList) => Array.prototype.slice.call(nodeList); | ||
@@ -50,8 +52,8 @@ exports.toArray = toArray; | ||
exports.toElem = toElem; | ||
const d = window.document; | ||
const d = () => window.document; | ||
const getScope = (scope) => { | ||
if (string_1.isString(scope)) | ||
return d.querySelector(scope); | ||
return d().querySelector(scope); | ||
if (scope === null) | ||
return d; | ||
return d(); | ||
return scope; | ||
@@ -65,3 +67,3 @@ }; | ||
return scope.ownerDocument; | ||
return d; | ||
return d(); | ||
}; | ||
@@ -68,0 +70,0 @@ exports.getDocument = getDocument; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.reset = exports.idpcState = void 0; | ||
const dom_1 = require("./dom"); | ||
let g = {}; | ||
if (window) { | ||
if (dom_1.hasWindow()) { | ||
if (window.idpcGlobal) { | ||
@@ -7,0 +8,0 @@ g = window.idpcGlobal; |
import { ParentTest, SelectorNode } from "./types"; | ||
export declare const hasWindow: () => boolean; | ||
export declare const toArray: <T = HTMLElement>(nodeList: NodeList) => T[]; | ||
@@ -3,0 +4,0 @@ export declare const loaded: (elem: HTMLElement) => boolean; |
import { isString } from "./string"; | ||
export const hasWindow = () => typeof window !== "undefined"; | ||
export const toArray = (nodeList) => Array.prototype.slice.call(nodeList); | ||
@@ -39,8 +40,8 @@ export const loaded = (elem) => elem.getAttribute("idpc") === "true"; | ||
}; | ||
const d = window.document; | ||
const d = () => window.document; | ||
export const getScope = (scope) => { | ||
if (isString(scope)) | ||
return d.querySelector(scope); | ||
return d().querySelector(scope); | ||
if (scope === null) | ||
return d; | ||
return d(); | ||
return scope; | ||
@@ -53,3 +54,3 @@ }; | ||
return scope.ownerDocument; | ||
return d; | ||
return d(); | ||
}; | ||
@@ -56,0 +57,0 @@ export const setStyle = (element, style) => { |
@@ -0,3 +1,4 @@ | ||
import { hasWindow } from "./dom"; | ||
let g = {}; | ||
if (window) { | ||
if (hasWindow()) { | ||
if (window.idpcGlobal) { | ||
@@ -4,0 +5,0 @@ g = window.idpcGlobal; |
{ | ||
"name": "@ideal-postcodes/jsutil", | ||
"version": "4.3.8", | ||
"version": "4.3.9", | ||
"description": "Browser Address Autocomplete for api.ideal-postcodes.co.uk", | ||
@@ -121,3 +121,3 @@ "author": { | ||
"dotenv": "~8.2.0", | ||
"eslint": "~7.24.0", | ||
"eslint": "~7.25.0", | ||
"eslint-plugin-compat": "~3.9.0", | ||
@@ -124,0 +124,0 @@ "karma": "~6.3.1", |
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
75744
1794