@dereekb/browser 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,11 @@
1
+ # browser
2
+
3
+ This library was generated with [Nx](https://nx.dev).
4
+
5
+ ## Building
6
+
7
+ Run `nx build browser` to build the library.
8
+
9
+ ## Running unit tests
10
+
11
+ Run `nx test browser` to execute the unit tests via [Jest](https://jestjs.io).
package/package.json ADDED
@@ -0,0 +1,7 @@
1
+ {
2
+ "name": "@dereekb/browser",
3
+ "version": "0.0.1",
4
+ "type": "commonjs",
5
+ "main": "./src/index.js",
6
+ "typings": "./src/index.d.ts"
7
+ }
package/src/index.d.ts ADDED
@@ -0,0 +1 @@
1
+ export * from './lib/window';
package/src/index.js ADDED
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ (0, tslib_1.__exportStar)(require("./lib/window"), exports);
5
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../packages/browser/src/index.ts"],"names":[],"mappings":";;;AAAA,4DAA6B"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Whether or not the current host is localhost. Useful for determining local dev environments.
3
+ */
4
+ export declare function isLocalhost(): boolean;
5
+ export declare function makeWindowPath(path: string): string;
6
+ export declare function getBaseWindowUrl(): string;
7
+ export declare function getWindowPathNameWithQuery(): string;
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ // MARK: Window Location Utiltiies
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.getWindowPathNameWithQuery = exports.getBaseWindowUrl = exports.makeWindowPath = exports.isLocalhost = void 0;
5
+ /**
6
+ * Whether or not the current host is localhost. Useful for determining local dev environments.
7
+ */
8
+ function isLocalhost() {
9
+ return window.location.hostname === 'localhost';
10
+ }
11
+ exports.isLocalhost = isLocalhost;
12
+ function makeWindowPath(path) {
13
+ return `${getBaseWindowUrl()}${path}`;
14
+ }
15
+ exports.makeWindowPath = makeWindowPath;
16
+ function getBaseWindowUrl() {
17
+ const port = (window.location.port) ? (':' + window.location.port) : '';
18
+ return `${window.location.protocol}//${window.location.hostname}${port}`;
19
+ }
20
+ exports.getBaseWindowUrl = getBaseWindowUrl;
21
+ function getWindowPathNameWithQuery() {
22
+ return window.location.pathname + window.location.search;
23
+ }
24
+ exports.getWindowPathNameWithQuery = getWindowPathNameWithQuery;
25
+ //# sourceMappingURL=window.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"window.js","sourceRoot":"","sources":["../../../../../packages/browser/src/lib/window.ts"],"names":[],"mappings":";AACA,kCAAkC;;;AAElC;;GAEG;AACH,SAAgB,WAAW;IACzB,OAAO,MAAM,CAAC,QAAQ,CAAC,QAAQ,KAAK,WAAW,CAAC;AAClD,CAAC;AAFD,kCAEC;AAED,SAAgB,cAAc,CAAC,IAAY;IACzC,OAAO,GAAG,gBAAgB,EAAE,GAAG,IAAI,EAAE,CAAC;AACxC,CAAC;AAFD,wCAEC;AAED,SAAgB,gBAAgB;IAC9B,MAAM,IAAI,GAAG,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,GAAG,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IACxE,OAAO,GAAG,MAAM,CAAC,QAAQ,CAAC,QAAQ,KAAK,MAAM,CAAC,QAAQ,CAAC,QAAQ,GAAG,IAAI,EAAE,CAAC;AAC3E,CAAC;AAHD,4CAGC;AAED,SAAgB,0BAA0B;IACxC,OAAO,MAAM,CAAC,QAAQ,CAAC,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC;AAC3D,CAAC;AAFD,gEAEC"}