@selfcommunity/utils 0.1.7-alpha.0 → 0.1.8-alpha.0

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.
Files changed (71) hide show
  1. package/lib/{types → cjs}/index.d.ts +2 -2
  2. package/lib/cjs/index.d.ts.map +1 -0
  3. package/lib/cjs/index.js +35 -50
  4. package/lib/cjs/index.js.map +1 -0
  5. package/lib/{types → cjs}/utils/browser.d.ts +0 -0
  6. package/lib/{types → cjs}/utils/browser.d.ts.map +0 -0
  7. package/lib/cjs/utils/browser.js +62 -78
  8. package/lib/cjs/utils/browser.js.map +1 -0
  9. package/lib/{types → cjs}/utils/logger.d.ts +0 -0
  10. package/lib/{types → cjs}/utils/logger.d.ts.map +0 -0
  11. package/lib/cjs/utils/logger.js +18 -25
  12. package/lib/cjs/utils/logger.js.map +1 -0
  13. package/lib/{types → cjs}/utils/object.d.ts +0 -0
  14. package/lib/{types → cjs}/utils/object.d.ts.map +0 -0
  15. package/lib/cjs/utils/object.js +23 -29
  16. package/lib/cjs/utils/object.js.map +1 -0
  17. package/lib/{types → cjs}/utils/string.d.ts +0 -0
  18. package/lib/{types → cjs}/utils/string.d.ts.map +0 -0
  19. package/lib/cjs/utils/string.js +56 -65
  20. package/lib/cjs/utils/string.js.map +1 -0
  21. package/lib/{types → cjs}/utils/url.d.ts +0 -0
  22. package/lib/{types → cjs}/utils/url.d.ts.map +0 -0
  23. package/lib/cjs/utils/url.js +52 -77
  24. package/lib/cjs/utils/url.js.map +1 -0
  25. package/lib/{types → cjs}/utils/websocket.d.ts +0 -0
  26. package/lib/{types → cjs}/utils/websocket.d.ts.map +0 -0
  27. package/lib/cjs/utils/websocket.js +221 -284
  28. package/lib/cjs/utils/websocket.js.map +1 -0
  29. package/lib/cjs/utils/window.d.ts +5 -0
  30. package/lib/cjs/utils/window.d.ts.map +1 -0
  31. package/lib/cjs/utils/window.js +34 -32
  32. package/lib/cjs/utils/window.js.map +1 -0
  33. package/lib/esm/index.d.ts +12 -0
  34. package/lib/esm/index.d.ts.map +1 -0
  35. package/lib/esm/index.js +12 -51
  36. package/lib/esm/index.js.map +1 -0
  37. package/lib/esm/utils/browser.d.ts +9 -0
  38. package/lib/esm/utils/browser.d.ts.map +1 -0
  39. package/lib/esm/utils/browser.js +61 -81
  40. package/lib/esm/utils/browser.js.map +1 -0
  41. package/lib/esm/utils/logger.d.ts +11 -0
  42. package/lib/esm/utils/logger.d.ts.map +1 -0
  43. package/lib/esm/utils/logger.js +17 -28
  44. package/lib/esm/utils/logger.js.map +1 -0
  45. package/lib/esm/utils/object.d.ts +13 -0
  46. package/lib/esm/utils/object.d.ts.map +1 -0
  47. package/lib/esm/utils/object.js +21 -32
  48. package/lib/esm/utils/object.js.map +1 -0
  49. package/lib/esm/utils/string.d.ts +43 -0
  50. package/lib/esm/utils/string.d.ts.map +1 -0
  51. package/lib/esm/utils/string.js +54 -73
  52. package/lib/esm/utils/string.js.map +1 -0
  53. package/lib/esm/utils/url.d.ts +33 -0
  54. package/lib/esm/utils/url.d.ts.map +1 -0
  55. package/lib/esm/utils/url.js +46 -80
  56. package/lib/esm/utils/url.js.map +1 -0
  57. package/lib/esm/utils/websocket.d.ts +177 -0
  58. package/lib/esm/utils/websocket.d.ts.map +1 -0
  59. package/lib/esm/utils/websocket.js +220 -286
  60. package/lib/esm/utils/websocket.js.map +1 -0
  61. package/lib/esm/utils/window.d.ts +5 -0
  62. package/lib/esm/utils/window.d.ts.map +1 -0
  63. package/lib/esm/utils/window.js +31 -36
  64. package/lib/esm/utils/window.js.map +1 -0
  65. package/lib/umd/utils.js +1 -1
  66. package/lib/umd/utils.js.map +1 -1
  67. package/package.json +5 -7
  68. package/lib/cjs/index.d.js +0 -2
  69. package/lib/esm/index.d.js +0 -2
  70. package/lib/types/index.d.ts.map +0 -1
  71. package/lib/types/tsconfig.build.tsbuildinfo +0 -1
@@ -1,6 +1,6 @@
1
1
  import { capitalize, isString, stripHtml, camelCase, copyTextToClipboard, fallbackCopyTextToClipboard, random } from './utils/string';
2
2
  import { isValidUrl, isValidUrls, urlReplacer, getDomain, appendURLSearchParams, urlB64ToUint8Array } from './utils/url';
3
- import { getHighestSafeWindowContext, getWindowWidth, getWindowHeight } from './utils/window';
3
+ import { getHighestSafeWindowContext, getWindowWidth, getWindowHeight, isClientSideRendering } from './utils/window';
4
4
  import { mergeDeep, isObject } from './utils/object';
5
5
  import { loadVersionBrowser } from './utils/browser';
6
6
  import { Logger } from './utils/logger';
@@ -8,5 +8,5 @@ import WSClient, { WSClientType, WSClientPropTypes } from './utils/websocket';
8
8
  /**
9
9
  * Export all utilities
10
10
  */
11
- export { capitalize, isString, stripHtml, camelCase, copyTextToClipboard, fallbackCopyTextToClipboard, random, isValidUrl, isValidUrls, urlReplacer, getDomain, appendURLSearchParams, urlB64ToUint8Array, getHighestSafeWindowContext, getWindowWidth, getWindowHeight, Logger, mergeDeep, isObject, WSClient, WSClientType, WSClientPropTypes, loadVersionBrowser };
11
+ export { capitalize, isString, stripHtml, camelCase, copyTextToClipboard, fallbackCopyTextToClipboard, random, isValidUrl, isValidUrls, urlReplacer, getDomain, appendURLSearchParams, urlB64ToUint8Array, getHighestSafeWindowContext, getWindowWidth, getWindowHeight, isClientSideRendering, Logger, mergeDeep, isObject, WSClient, WSClientType, WSClientPropTypes, loadVersionBrowser };
12
12
  //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAE,QAAQ,EAAE,SAAS,EAAE,SAAS,EAAE,mBAAmB,EAAE,2BAA2B,EAAE,MAAM,EAAC,MAAM,gBAAgB,CAAC;AACpI,OAAO,EAAC,UAAU,EAAE,WAAW,EAAE,WAAW,EAAE,SAAS,EAAE,qBAAqB,EAAE,kBAAkB,EAAC,MAAM,aAAa,CAAC;AACvH,OAAO,EAAC,2BAA2B,EAAE,cAAc,EAAE,eAAe,EAAE,qBAAqB,EAAC,MAAM,gBAAgB,CAAC;AACnH,OAAO,EAAC,SAAS,EAAE,QAAQ,EAAC,MAAM,gBAAgB,CAAC;AACnD,OAAO,EAAC,kBAAkB,EAAC,MAAM,iBAAiB,CAAC;AACnD,OAAO,EAAC,MAAM,EAAC,MAAM,gBAAgB,CAAC;AACtC,OAAO,QAAQ,EAAE,EAAC,YAAY,EAAE,iBAAiB,EAAC,MAAM,mBAAmB,CAAC;AAE5E;;GAEG;AACH,OAAO,EACL,UAAU,EACV,QAAQ,EACR,SAAS,EACT,SAAS,EACT,mBAAmB,EACnB,2BAA2B,EAC3B,MAAM,EACN,UAAU,EACV,WAAW,EACX,WAAW,EACX,SAAS,EACT,qBAAqB,EACrB,kBAAkB,EAClB,2BAA2B,EAC3B,cAAc,EACd,eAAe,EACf,qBAAqB,EACrB,MAAM,EACN,SAAS,EACT,QAAQ,EACR,QAAQ,EACR,YAAY,EACZ,iBAAiB,EACjB,kBAAkB,EACnB,CAAC"}
package/lib/cjs/index.js CHANGED
@@ -1,51 +1,36 @@
1
1
  "use strict";
2
-
3
- exports.__esModule = true;
4
-
5
- var _string = require("./utils/string");
6
-
7
- exports.capitalize = _string.capitalize;
8
- exports.isString = _string.isString;
9
- exports.stripHtml = _string.stripHtml;
10
- exports.camelCase = _string.camelCase;
11
- exports.copyTextToClipboard = _string.copyTextToClipboard;
12
- exports.fallbackCopyTextToClipboard = _string.fallbackCopyTextToClipboard;
13
- exports.random = _string.random;
14
-
15
- var _url = require("./utils/url");
16
-
17
- exports.isValidUrl = _url.isValidUrl;
18
- exports.isValidUrls = _url.isValidUrls;
19
- exports.urlReplacer = _url.urlReplacer;
20
- exports.getDomain = _url.getDomain;
21
- exports.appendURLSearchParams = _url.appendURLSearchParams;
22
- exports.urlB64ToUint8Array = _url.urlB64ToUint8Array;
23
-
24
- var _window = require("./utils/window");
25
-
26
- exports.getHighestSafeWindowContext = _window.getHighestSafeWindowContext;
27
- exports.getWindowWidth = _window.getWindowWidth;
28
- exports.getWindowHeight = _window.getWindowHeight;
29
-
30
- var _object = require("./utils/object");
31
-
32
- exports.mergeDeep = _object.mergeDeep;
33
- exports.isObject = _object.isObject;
34
-
35
- var _browser = require("./utils/browser");
36
-
37
- exports.loadVersionBrowser = _browser.loadVersionBrowser;
38
-
39
- var _logger = require("./utils/logger");
40
-
41
- exports.Logger = _logger.Logger;
42
-
43
- var _websocket = _interopRequireWildcard(require("./utils/websocket"));
44
-
45
- exports.WSClient = _websocket.default;
46
- exports.WSClientType = _websocket.WSClientType;
47
- exports.WSClientPropTypes = _websocket.WSClientPropTypes;
48
-
49
- function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
50
-
51
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.loadVersionBrowser = exports.WSClient = exports.isObject = exports.mergeDeep = exports.Logger = exports.isClientSideRendering = exports.getWindowHeight = exports.getWindowWidth = exports.getHighestSafeWindowContext = exports.urlB64ToUint8Array = exports.appendURLSearchParams = exports.getDomain = exports.urlReplacer = exports.isValidUrls = exports.isValidUrl = exports.random = exports.fallbackCopyTextToClipboard = exports.copyTextToClipboard = exports.camelCase = exports.stripHtml = exports.isString = exports.capitalize = void 0;
7
+ const string_1 = require("./utils/string");
8
+ Object.defineProperty(exports, "capitalize", { enumerable: true, get: function () { return string_1.capitalize; } });
9
+ Object.defineProperty(exports, "isString", { enumerable: true, get: function () { return string_1.isString; } });
10
+ Object.defineProperty(exports, "stripHtml", { enumerable: true, get: function () { return string_1.stripHtml; } });
11
+ Object.defineProperty(exports, "camelCase", { enumerable: true, get: function () { return string_1.camelCase; } });
12
+ Object.defineProperty(exports, "copyTextToClipboard", { enumerable: true, get: function () { return string_1.copyTextToClipboard; } });
13
+ Object.defineProperty(exports, "fallbackCopyTextToClipboard", { enumerable: true, get: function () { return string_1.fallbackCopyTextToClipboard; } });
14
+ Object.defineProperty(exports, "random", { enumerable: true, get: function () { return string_1.random; } });
15
+ const url_1 = require("./utils/url");
16
+ Object.defineProperty(exports, "isValidUrl", { enumerable: true, get: function () { return url_1.isValidUrl; } });
17
+ Object.defineProperty(exports, "isValidUrls", { enumerable: true, get: function () { return url_1.isValidUrls; } });
18
+ Object.defineProperty(exports, "urlReplacer", { enumerable: true, get: function () { return url_1.urlReplacer; } });
19
+ Object.defineProperty(exports, "getDomain", { enumerable: true, get: function () { return url_1.getDomain; } });
20
+ Object.defineProperty(exports, "appendURLSearchParams", { enumerable: true, get: function () { return url_1.appendURLSearchParams; } });
21
+ Object.defineProperty(exports, "urlB64ToUint8Array", { enumerable: true, get: function () { return url_1.urlB64ToUint8Array; } });
22
+ const window_1 = require("./utils/window");
23
+ Object.defineProperty(exports, "getHighestSafeWindowContext", { enumerable: true, get: function () { return window_1.getHighestSafeWindowContext; } });
24
+ Object.defineProperty(exports, "getWindowWidth", { enumerable: true, get: function () { return window_1.getWindowWidth; } });
25
+ Object.defineProperty(exports, "getWindowHeight", { enumerable: true, get: function () { return window_1.getWindowHeight; } });
26
+ Object.defineProperty(exports, "isClientSideRendering", { enumerable: true, get: function () { return window_1.isClientSideRendering; } });
27
+ const object_1 = require("./utils/object");
28
+ Object.defineProperty(exports, "mergeDeep", { enumerable: true, get: function () { return object_1.mergeDeep; } });
29
+ Object.defineProperty(exports, "isObject", { enumerable: true, get: function () { return object_1.isObject; } });
30
+ const browser_1 = require("./utils/browser");
31
+ Object.defineProperty(exports, "loadVersionBrowser", { enumerable: true, get: function () { return browser_1.loadVersionBrowser; } });
32
+ const logger_1 = require("./utils/logger");
33
+ Object.defineProperty(exports, "Logger", { enumerable: true, get: function () { return logger_1.Logger; } });
34
+ const websocket_1 = __importDefault(require("./utils/websocket"));
35
+ exports.WSClient = websocket_1.default;
36
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;AAAA,2CAAoI;AAYlI,2FAZM,mBAAU,OAYN;AACV,yFAbkB,iBAAQ,OAalB;AACR,0FAd4B,kBAAS,OAc5B;AACT,0FAfuC,kBAAS,OAevC;AACT,oGAhBkD,4BAAmB,OAgBlD;AACnB,4GAjBuE,oCAA2B,OAiBvE;AAC3B,uFAlBoG,eAAM,OAkBpG;AAjBR,qCAAuH;AAkBrH,2FAlBM,gBAAU,OAkBN;AACV,4FAnBkB,iBAAW,OAmBlB;AACX,4FApB+B,iBAAW,OAoB/B;AACX,0FArB4C,eAAS,OAqB5C;AACT,sGAtBuD,2BAAqB,OAsBvD;AACrB,mGAvB8E,wBAAkB,OAuB9E;AAtBpB,2CAAmH;AAuBjH,4GAvBM,oCAA2B,OAuBN;AAC3B,+FAxBmC,uBAAc,OAwBnC;AACd,gGAzBmD,wBAAe,OAyBnD;AACf,sGA1BoE,8BAAqB,OA0BpE;AAzBvB,2CAAmD;AA2BjD,0FA3BM,kBAAS,OA2BN;AACT,yFA5BiB,iBAAQ,OA4BjB;AA3BV,6CAAmD;AA+BjD,mGA/BM,4BAAkB,OA+BN;AA9BpB,2CAAsC;AAwBpC,uFAxBM,eAAM,OAwBN;AAvBR,kEAA4E;AA0B1E,mBA1BK,mBAAQ,CA0BL"}
File without changes
File without changes
@@ -1,90 +1,74 @@
1
1
  "use strict";
2
-
3
- exports.__esModule = true;
2
+ Object.defineProperty(exports, "__esModule", { value: true });
4
3
  exports.loadVersionBrowser = void 0;
5
-
6
4
  /**
7
5
  * Get browser version to track on backend
8
6
  * @return {{name: string, version: null}|{name: string, version: string}|{name: *, version: *}|{name: string, version}}
9
7
  */
10
8
  const loadVersionBrowser = () => {
11
- if ('userAgentData' in navigator) {
12
- // navigator.userAgentData is not available in
13
- // Firefox and Safari
14
- const uaData = navigator['userAgentData']; // Outputs of navigator.userAgentData.brands[n].brand are e.g.
15
- // Chrome: 'Google Chrome'
16
- // Edge: 'Microsoft Edge'
17
- // Opera: 'Opera'
18
-
19
- let browsername;
20
- let browserversion;
21
- let chromeVersion = null;
22
-
23
- for (let i = 0; i < uaData['brands'].length; i++) {
24
- const brand = uaData['brands'][i].brand;
25
- browserversion = uaData['brands'][i].version;
26
-
27
- if (brand.match(/opera|chrome|edge|safari|firefox|msie|trident/i) !== null) {
28
- // If we have a chrome match, save the match, but try to find another match
29
- // E.g. Edge can also produce a false Chrome match.
30
- if (brand.match(/chrome/i) !== null) {
31
- chromeVersion = browserversion;
32
- } // If this is not a chrome match return immediately
33
- else {
34
- browsername = brand.substr(brand.indexOf(' ') + 1);
35
- return {
36
- name: browsername,
37
- version: browserversion
38
- };
9
+ if ('userAgentData' in navigator) {
10
+ // navigator.userAgentData is not available in
11
+ // Firefox and Safari
12
+ const uaData = navigator['userAgentData'];
13
+ // Outputs of navigator.userAgentData.brands[n].brand are e.g.
14
+ // Chrome: 'Google Chrome'
15
+ // Edge: 'Microsoft Edge'
16
+ // Opera: 'Opera'
17
+ let browsername;
18
+ let browserversion;
19
+ let chromeVersion = null;
20
+ for (let i = 0; i < uaData['brands'].length; i++) {
21
+ const brand = uaData['brands'][i].brand;
22
+ browserversion = uaData['brands'][i].version;
23
+ if (brand.match(/opera|chrome|edge|safari|firefox|msie|trident/i) !== null) {
24
+ // If we have a chrome match, save the match, but try to find another match
25
+ // E.g. Edge can also produce a false Chrome match.
26
+ if (brand.match(/chrome/i) !== null) {
27
+ chromeVersion = browserversion;
28
+ }
29
+ // If this is not a chrome match return immediately
30
+ else {
31
+ browsername = brand.substr(brand.indexOf(' ') + 1);
32
+ return {
33
+ name: browsername,
34
+ version: browserversion,
35
+ };
36
+ }
37
+ }
39
38
  }
40
- }
41
- } // No non-Chrome match was found. If we have a chrome match, return it.
42
-
43
-
44
- if (chromeVersion !== null) {
45
- return {
46
- name: 'chrome',
47
- version: chromeVersion
48
- };
39
+ // No non-Chrome match was found. If we have a chrome match, return it.
40
+ if (chromeVersion !== null) {
41
+ return {
42
+ name: 'chrome',
43
+ version: chromeVersion,
44
+ };
45
+ }
46
+ }
47
+ // If no userAgentData is not present, or if no match via userAgentData was found,
48
+ // try to extract the browser name and version from userAgent
49
+ const userAgent = navigator.userAgent;
50
+ let ua = userAgent;
51
+ let tem;
52
+ let M = ua.match(/(opera|chrome|safari|firefox|msie|trident(?=\/))\/?\s*(\d+)/i) || [];
53
+ if (/trident/i.test(M[1])) {
54
+ tem = /\brv[ :]+(\d+)/g.exec(ua) || [];
55
+ return { name: 'IE', version: tem[1] || '' };
56
+ }
57
+ if (M[1] === 'Chrome') {
58
+ tem = ua.match(/\bOPR\/(\d+)/);
59
+ if (tem != null) {
60
+ return { name: 'Opera', version: tem[1] };
61
+ }
62
+ }
63
+ M = M[2] ? [M[1], M[2]] : [navigator.appName, navigator.appVersion, '-?'];
64
+ // eslint-disable-next-line @typescript-eslint/prefer-regexp-exec
65
+ if ((tem = ua.match(/version\/(\d+)/i)) != null) {
66
+ M.splice(1, 1, tem[1]);
49
67
  }
50
- } // If no userAgentData is not present, or if no match via userAgentData was found,
51
- // try to extract the browser name and version from userAgent
52
-
53
-
54
- const userAgent = navigator.userAgent;
55
- let ua = userAgent;
56
- let tem;
57
- let M = ua.match(/(opera|chrome|safari|firefox|msie|trident(?=\/))\/?\s*(\d+)/i) || [];
58
-
59
- if (/trident/i.test(M[1])) {
60
- tem = /\brv[ :]+(\d+)/g.exec(ua) || [];
61
68
  return {
62
- name: 'IE',
63
- version: tem[1] || ''
69
+ name: M[0],
70
+ version: M[1],
64
71
  };
65
- }
66
-
67
- if (M[1] === 'Chrome') {
68
- tem = ua.match(/\bOPR\/(\d+)/);
69
-
70
- if (tem != null) {
71
- return {
72
- name: 'Opera',
73
- version: tem[1]
74
- };
75
- }
76
- }
77
-
78
- M = M[2] ? [M[1], M[2]] : [navigator.appName, navigator.appVersion, '-?']; // eslint-disable-next-line @typescript-eslint/prefer-regexp-exec
79
-
80
- if ((tem = ua.match(/version\/(\d+)/i)) != null) {
81
- M.splice(1, 1, tem[1]);
82
- }
83
-
84
- return {
85
- name: M[0],
86
- version: M[1]
87
- };
88
72
  };
89
-
90
- exports.loadVersionBrowser = loadVersionBrowser;
73
+ exports.loadVersionBrowser = loadVersionBrowser;
74
+ //# sourceMappingURL=browser.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"browser.js","sourceRoot":"","sources":["../../../src/utils/browser.ts"],"names":[],"mappings":";;;AAAA;;;GAGG;AACI,MAAM,kBAAkB,GAAG,GAAG,EAAE;IACrC,IAAI,eAAe,IAAI,SAAS,EAAE;QAChC,8CAA8C;QAC9C,qBAAqB;QACrB,MAAM,MAAM,GAAe,SAAS,CAAC,eAAe,CAAC,CAAC;QACtD,8DAA8D;QAC9D,0BAA0B;QAC1B,yBAAyB;QACzB,iBAAiB;QACjB,IAAI,WAAW,CAAC;QAChB,IAAI,cAAc,CAAC;QACnB,IAAI,aAAa,GAAG,IAAI,CAAC;QACzB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAC,MAAM,EA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CAAC,CAAC,CAAC,CAAC,KAAK,QAAQ,EAAE;QACrB,GAAG,GAAG,EAAE,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC;QAC/B,IAAI,GAAG,IAAI,IAAI,EAAE;YACf,OAAO,EAAC,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,CAAC,CAAC,CAAC,EAAC,CAAC;SACzC;KACF;IACD,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,OAAO,EAAE,SAAS,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC;IAC1E,iEAAiE;IACjE,IAAI,CAAC,GAAG,GAAG,EAAE,CAAC,KAAK,CAAC,iBAAiB,CAAC,CAAC,IAAI,IAAI,EAAE;QAC/C,CAAC,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;KACxB;IACD,OAAO;QACL,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;QACV,OAAO,EAAE,CAAC,CAAC,CAAC,CAAC;KACd,CAAC;AACJ,CAAC,CAAC;AAhEW,QAAA,kBAAkB,sBAgE7B"}
File without changes
File without changes
@@ -1,32 +1,25 @@
1
1
  "use strict";
2
-
3
- exports.__esModule = true;
2
+ Object.defineProperty(exports, "__esModule", { value: true });
4
3
  exports.Logger = void 0;
5
-
6
4
  /**
7
5
  * Emit styled message
8
6
  */
9
7
  class Logger {
10
- static info(scope, message) {
11
- console.info(`%c[${scope}]`, 'color:#008080', ` ${message}`);
12
- }
13
-
14
- static warn(scope, message) {
15
- console.warn(`%c[${scope}]`, 'color:#008080', ` ${message}`);
16
- }
17
-
18
- static error(scope, message) {
19
- console.error(`%c[${scope}]`, 'color:#008080', ` ${message}`);
20
- }
21
-
22
- static log(scope, message) {
23
- console.log(`%c[${scope}]`, 'color:#008080', ` ${message}`);
24
- }
25
-
26
- static debug(scope, message) {
27
- console.debug(`%c[${scope}]`, 'color:#008080', ` ${message}`);
28
- }
29
-
8
+ static info(scope, message) {
9
+ console.info(`%c[${scope}]`, 'color:#008080', ` ${message}`);
10
+ }
11
+ static warn(scope, message) {
12
+ console.warn(`%c[${scope}]`, 'color:#008080', ` ${message}`);
13
+ }
14
+ static error(scope, message) {
15
+ console.error(`%c[${scope}]`, 'color:#008080', ` ${message}`);
16
+ }
17
+ static log(scope, message) {
18
+ console.log(`%c[${scope}]`, 'color:#008080', ` ${message}`);
19
+ }
20
+ static debug(scope, message) {
21
+ console.debug(`%c[${scope}]`, 'color:#008080', ` ${message}`);
22
+ }
30
23
  }
31
-
32
- exports.Logger = Logger;
24
+ exports.Logger = Logger;
25
+ //# sourceMappingURL=logger.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logger.js","sourceRoot":"","sources":["../../../src/utils/logger.ts"],"names":[],"mappings":";;;AAAA;;GAEG;AACH,MAAa,MAAM;IACjB,MAAM,CAAC,IAAI,CAAC,KAAK,EAAE,OAAO;QACxB,OAAO,CAAC,IAAI,CAAC,MAAM,KAAK,GAAG,EAAE,eAAe,EAAE,IAAI,OAAO,EAAE,CAAC,CAAC;IAC/D,CAAC;IAED,MAAM,CAAC,IAAI,CAAC,KAAK,EAAE,OAAO;QACxB,OAAO,CAAC,IAAI,CAAC,MAAM,KAAK,GAAG,EAAE,eAAe,EAAE,IAAI,OAAO,EAAE,CAAC,CAAC;IAC/D,CAAC;IAED,MAAM,CAAC,KAAK,CAAC,KAAK,EAAE,OAAO;QACzB,OAAO,CAAC,KAAK,CAAC,MAAM,KAAK,GAAG,EAAE,eAAe,EAAE,IAAI,OAAO,EAAE,CAAC,CAAC;IAChE,CAAC;IAED,MAAM,CAAC,GAAG,CAAC,KAAK,EAAE,OAAO;QACvB,OAAO,CAAC,GAAG,CAAC,MAAM,KAAK,GAAG,EAAE,eAAe,EAAE,IAAI,OAAO,EAAE,CAAC,CAAC;IAC9D,CAAC;IAED,MAAM,CAAC,KAAK,CAAC,KAAK,EAAE,OAAO;QACzB,OAAO,CAAC,KAAK,CAAC,MAAM,KAAK,GAAG,EAAE,eAAe,EAAE,IAAI,OAAO,EAAE,CAAC,CAAC;IAChE,CAAC;CACF;AApBD,wBAoBC"}
File without changes
File without changes
@@ -1,44 +1,38 @@
1
1
  "use strict";
2
-
3
- exports.__esModule = true;
4
- exports.isObject = isObject;
5
- exports.mergeDeep = mergeDeep;
6
-
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.mergeDeep = exports.isObject = void 0;
7
4
  /**
8
5
  * Check if v is an object
9
6
  * @param v
10
7
  */
11
8
  function isObject(v) {
12
- return typeof v === 'object' && !Array.isArray(v) && v !== null;
9
+ return typeof v === 'object' && !Array.isArray(v) && v !== null;
13
10
  }
11
+ exports.isObject = isObject;
14
12
  /**
15
13
  * Perfrom deep merge of two objects (not a shallow merge)
16
14
  * @param target
17
15
  * @param source
18
16
  * @return {*}
19
17
  */
20
-
21
-
22
18
  function mergeDeep(target, source) {
23
- let output = Object.assign({}, target);
24
-
25
- if (isObject(target) && isObject(source)) {
26
- Object.keys(source).forEach(key => {
27
- if (isObject(source[key])) {
28
- if (!(key in target)) {
29
- Object.assign(output, {
30
- [key]: source[key]
31
- });
32
- } else {
33
- output[key] = mergeDeep(target[key], source[key]);
34
- }
35
- } else {
36
- Object.assign(output, {
37
- [key]: source[key]
19
+ let output = Object.assign({}, target);
20
+ if (isObject(target) && isObject(source)) {
21
+ Object.keys(source).forEach((key) => {
22
+ if (isObject(source[key])) {
23
+ if (!(key in target)) {
24
+ Object.assign(output, { [key]: source[key] });
25
+ }
26
+ else {
27
+ output[key] = mergeDeep(target[key], source[key]);
28
+ }
29
+ }
30
+ else {
31
+ Object.assign(output, { [key]: source[key] });
32
+ }
38
33
  });
39
- }
40
- });
41
- }
42
-
43
- return output;
44
- }
34
+ }
35
+ return output;
36
+ }
37
+ exports.mergeDeep = mergeDeep;
38
+ //# sourceMappingURL=object.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"object.js","sourceRoot":"","sources":["../../../src/utils/object.ts"],"names":[],"mappings":";;;AAAA;;;GAGG;AACH,SAAgB,QAAQ,CAAC,CAAC;IACxB,OAAO,OAAO,CAAC,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,IAAI,CAAC;AAClE,CAAC;AAFD,4BAEC;AAED;;;;;GAKG;AACH,SAAgB,SAAS,CAAC,MAAc,EAAE,MAAc;IACtD,IAAI,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,MAAM,CAAC,CAAC;IACvC,IAAI,QAAQ,CAAC,MAAM,CAAC,IAAI,QAAQ,CAAC,MAAM,CAAC,EAAE;QACxC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,EAAE;YAClC,IAAI,QAAQ,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,EAAE;gBACzB,IAAI,CAAC,CAAC,GAAG,IAAI,MAAM,CAAC,EAAE;oBACpB,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,EAAC,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC,GAAG,CAAC,EAAC,CAAC,CAAC;iBAC7C;qBAAM;oBACL,MAAM,CAAC,GAAG,CAAC,GAAG,SAAS,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC;iBACnD;aACF;iBAAM;gBACL,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,EAAC,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC,GAAG,CAAC,EAAC,CAAC,CAAC;aAC7C;QACH,CAAC,CAAC,CAAC;KACJ;IACD,OAAO,MAAM,CAAC;AAChB,CAAC;AAhBD,8BAgBC"}
File without changes
File without changes
@@ -1,94 +1,86 @@
1
1
  "use strict";
2
-
3
- exports.__esModule = true;
4
- exports.camelCase = camelCase;
5
- exports.capitalize = capitalize;
6
- exports.copyTextToClipboard = copyTextToClipboard;
7
- exports.fallbackCopyTextToClipboard = fallbackCopyTextToClipboard;
8
- exports.isString = isString;
9
- exports.random = random;
10
- exports.stripHtml = stripHtml;
11
-
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.copyTextToClipboard = exports.fallbackCopyTextToClipboard = exports.random = exports.stripHtml = exports.camelCase = exports.capitalize = exports.isString = void 0;
12
4
  /**
13
5
  * Check if v is a string
14
6
  * @param v
15
7
  */
16
8
  function isString(v) {
17
- return typeof v === 'string' || v instanceof String;
9
+ return typeof v === 'string' || v instanceof String;
18
10
  }
11
+ exports.isString = isString;
19
12
  /**
20
13
  * Capitalize a string
21
14
  * @param str
22
15
  */
23
-
24
-
25
16
  function capitalize(str) {
26
- let strVal = '';
27
- let strArr = str.split(' ');
28
-
29
- for (let chr = 0; chr < strArr.length; chr++) {
30
- strVal += strArr[chr].substring(0, 1).toUpperCase() + strArr[chr].substring(1, strArr[chr].length);
31
- }
32
-
33
- return strVal;
17
+ let strVal = '';
18
+ let strArr = str.split(' ');
19
+ for (let chr = 0; chr < strArr.length; chr++) {
20
+ strVal += strArr[chr].substring(0, 1).toUpperCase() + strArr[chr].substring(1, strArr[chr].length);
21
+ }
22
+ return strVal;
34
23
  }
24
+ exports.capitalize = capitalize;
35
25
  /**
36
26
  * CamelCase a string
37
27
  * @param str
38
28
  */
39
-
40
-
41
29
  function camelCase(str) {
42
- // Lower cases the string
43
- return str.toLowerCase() // Replaces any - or _ characters with a space
44
- .replace(/[-_]+/g, ' ') // Removes any non alphanumeric characters
45
- .replace(/[^\w\s]/g, '') // Uppercases the first character in each group immediately following a space
46
- // (delimited by spaces)
47
- .replace(/ (.)/g, $1 => {
48
- return $1.toUpperCase();
49
- }) // Removes spaces
50
- .replace(/ /g, '');
30
+ // Lower cases the string
31
+ return (str
32
+ .toLowerCase()
33
+ // Replaces any - or _ characters with a space
34
+ .replace(/[-_]+/g, ' ')
35
+ // Removes any non alphanumeric characters
36
+ .replace(/[^\w\s]/g, '')
37
+ // Uppercases the first character in each group immediately following a space
38
+ // (delimited by spaces)
39
+ .replace(/ (.)/g, ($1) => {
40
+ return $1.toUpperCase();
41
+ })
42
+ // Removes spaces
43
+ .replace(/ /g, ''));
51
44
  }
45
+ exports.camelCase = camelCase;
52
46
  /**
53
47
  * Stripe html tags from a string
54
48
  * @param str
55
49
  */
56
-
57
-
58
50
  function stripHtml(str) {
59
- return str.replace(/<[^>]*>?/gm, '').trim();
51
+ return str.replace(/<[^>]*>?/gm, '').trim();
60
52
  }
61
-
53
+ exports.stripHtml = stripHtml;
62
54
  function random() {
63
- return (Math.random() + 1).toString(36).substring(7);
55
+ return (Math.random() + 1).toString(36).substring(7);
64
56
  }
57
+ exports.random = random;
65
58
  /**
66
59
  * Fallback if navigator.clipboard doensn't exist
67
60
  * @param text
68
61
  * @returns {Promise<void>}
69
62
  */
70
-
71
-
72
63
  function fallbackCopyTextToClipboard(text) {
73
- let textArea = document.createElement('textarea');
74
- textArea.value = text; // Avoid scrolling to bottom
75
-
76
- textArea.style.top = '0';
77
- textArea.style.left = '0';
78
- textArea.style.position = 'fixed';
79
- document.body.appendChild(textArea);
80
- textArea.focus();
81
- textArea.select();
82
-
83
- try {
84
- document.execCommand('copy');
85
- document.body.removeChild(textArea);
86
- return Promise.resolve();
87
- } catch (err) {
88
- document.body.removeChild(textArea);
89
- return Promise.reject(err);
90
- }
64
+ let textArea = document.createElement('textarea');
65
+ textArea.value = text;
66
+ // Avoid scrolling to bottom
67
+ textArea.style.top = '0';
68
+ textArea.style.left = '0';
69
+ textArea.style.position = 'fixed';
70
+ document.body.appendChild(textArea);
71
+ textArea.focus();
72
+ textArea.select();
73
+ try {
74
+ document.execCommand('copy');
75
+ document.body.removeChild(textArea);
76
+ return Promise.resolve();
77
+ }
78
+ catch (err) {
79
+ document.body.removeChild(textArea);
80
+ return Promise.reject(err);
81
+ }
91
82
  }
83
+ exports.fallbackCopyTextToClipboard = fallbackCopyTextToClipboard;
92
84
  /**
93
85
  * Copy text to clipboard
94
86
  * @param text
@@ -103,12 +95,11 @@ function fallbackCopyTextToClipboard(text) {
103
95
  * console.error('Async: Could not copy text: ', err);
104
96
  * });
105
97
  */
106
-
107
-
108
98
  function copyTextToClipboard(text) {
109
- if (!navigator.clipboard) {
110
- return fallbackCopyTextToClipboard(text);
111
- }
112
-
113
- return navigator.clipboard.writeText(text);
114
- }
99
+ if (!navigator.clipboard) {
100
+ return fallbackCopyTextToClipboard(text);
101
+ }
102
+ return navigator.clipboard.writeText(text);
103
+ }
104
+ exports.copyTextToClipboard = copyTextToClipboard;
105
+ //# sourceMappingURL=string.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"string.js","sourceRoot":"","sources":["../../../src/utils/string.ts"],"names":[],"mappings":";;;AAAA;;;GAGG;AACH,SAAgB,QAAQ,CAAC,CAAC;IACxB,OAAO,OAAO,CAAC,KAAK,QAAQ,IAAI,CAAC,YAAY,MAAM,CAAC;AACtD,CAAC;AAFD,4BAEC;AAED;;;GAGG;AACH,SAAgB,UAAU,CAAC,GAAW;IACpC,IAAI,MAAM,GAAG,EAAE,CAAC;IAChB,IAAI,MAAM,GAAa,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACtC,KAAK,IAAI,GAAG,GAAG,CAAC,EAAE,GAAG,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,EAAE,EAAE;QAC5C,MAAM,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,SAAS,CAAC,CAAC,EAAE,MAAM,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC;KACpG;IACD,OAAO,MAAM,CAAC;AAChB,CAAC;AAPD,gCAOC;AAED;;;GAGG;AACH,S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