@kwiz/common 1.0.90 → 1.0.92

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 (99) hide show
  1. package/.github/workflows/npm-publish.yml +24 -24
  2. package/.madgerc +2 -2
  3. package/LICENSE +21 -21
  4. package/fix-folder-imports.js +26 -26
  5. package/lib/cjs/helpers/browser.js +42 -20
  6. package/lib/cjs/helpers/browser.js.map +1 -1
  7. package/lib/cjs/types/libs/msal.types.js +26 -26
  8. package/lib/cjs/utils/sharepoint.rest/user.js +11 -11
  9. package/lib/esm/helpers/browser.js +42 -20
  10. package/lib/esm/helpers/browser.js.map +1 -1
  11. package/lib/esm/types/libs/msal.types.js +26 -26
  12. package/lib/esm/utils/sharepoint.rest/user.js +11 -11
  13. package/lib/types/helpers/browser.d.ts +1 -0
  14. package/package.json +81 -80
  15. package/readme.md +17 -17
  16. package/src/_dependencies.ts +12 -12
  17. package/src/config.ts +17 -17
  18. package/src/helpers/Guid.ts +181 -181
  19. package/src/helpers/base64.ts +173 -173
  20. package/src/helpers/browser.test.js +13 -13
  21. package/src/helpers/browser.ts +1386 -1358
  22. package/src/helpers/browserinfo.ts +292 -292
  23. package/src/helpers/collections.base.test.js +25 -25
  24. package/src/helpers/collections.base.ts +437 -437
  25. package/src/helpers/collections.ts +107 -107
  26. package/src/helpers/color.ts +54 -54
  27. package/src/helpers/cookies.ts +59 -59
  28. package/src/helpers/date.test.js +119 -119
  29. package/src/helpers/date.ts +188 -188
  30. package/src/helpers/debug.ts +186 -186
  31. package/src/helpers/emails.ts +6 -6
  32. package/src/helpers/eval.ts +5 -5
  33. package/src/helpers/file.test.js +50 -50
  34. package/src/helpers/file.ts +60 -60
  35. package/src/helpers/flatted.ts +149 -149
  36. package/src/helpers/functions.ts +16 -16
  37. package/src/helpers/graph/calendar.types.ts +10 -10
  38. package/src/helpers/http.ts +69 -69
  39. package/src/helpers/images.ts +22 -22
  40. package/src/helpers/json.ts +38 -38
  41. package/src/helpers/md5.ts +189 -189
  42. package/src/helpers/objects.test.js +33 -33
  43. package/src/helpers/objects.ts +274 -274
  44. package/src/helpers/promises.test.js +37 -37
  45. package/src/helpers/promises.ts +165 -165
  46. package/src/helpers/random.ts +27 -27
  47. package/src/helpers/scheduler/scheduler.test.js +103 -103
  48. package/src/helpers/scheduler/scheduler.ts +131 -131
  49. package/src/helpers/sharepoint.ts +776 -776
  50. package/src/helpers/strings.test.js +101 -101
  51. package/src/helpers/strings.ts +317 -317
  52. package/src/helpers/typecheckers.test.js +34 -34
  53. package/src/helpers/typecheckers.ts +266 -266
  54. package/src/helpers/url.test.js +43 -43
  55. package/src/helpers/url.ts +207 -207
  56. package/src/helpers/urlhelper.ts +111 -111
  57. package/src/index.ts +6 -6
  58. package/src/types/auth.ts +54 -54
  59. package/src/types/common.types.ts +15 -15
  60. package/src/types/flatted.types.ts +59 -59
  61. package/src/types/globals.types.ts +6 -6
  62. package/src/types/graph/calendar.types.ts +80 -80
  63. package/src/types/knownscript.types.ts +18 -18
  64. package/src/types/libs/datajs.types.ts +28 -28
  65. package/src/types/libs/ics.types.ts +30 -30
  66. package/src/types/libs/msal.types.ts +49 -49
  67. package/src/types/locales.ts +124 -124
  68. package/src/types/localstoragecache.types.ts +8 -8
  69. package/src/types/location.types.ts +27 -27
  70. package/src/types/moment.ts +11 -11
  71. package/src/types/regex.types.ts +16 -16
  72. package/src/types/rest.types.ts +95 -95
  73. package/src/types/sharepoint.types.ts +1465 -1465
  74. package/src/types/sharepoint.utils.types.ts +287 -287
  75. package/src/utils/auth/common.ts +74 -74
  76. package/src/utils/auth/discovery.test.js +12 -12
  77. package/src/utils/auth/discovery.ts +132 -132
  78. package/src/utils/base64.ts +27 -27
  79. package/src/utils/consolelogger.ts +320 -320
  80. package/src/utils/date.ts +35 -35
  81. package/src/utils/emails.ts +24 -24
  82. package/src/utils/knownscript.ts +286 -286
  83. package/src/utils/localstoragecache.ts +441 -441
  84. package/src/utils/rest.ts +501 -501
  85. package/src/utils/script.ts +170 -170
  86. package/src/utils/sharepoint.rest/common.ts +154 -154
  87. package/src/utils/sharepoint.rest/date.ts +62 -62
  88. package/src/utils/sharepoint.rest/file.folder.ts +598 -598
  89. package/src/utils/sharepoint.rest/item.ts +547 -547
  90. package/src/utils/sharepoint.rest/list.ts +1480 -1480
  91. package/src/utils/sharepoint.rest/listutils/GetListItemsByCaml.ts +774 -774
  92. package/src/utils/sharepoint.rest/listutils/GetListItemsById.ts +275 -275
  93. package/src/utils/sharepoint.rest/listutils/common.ts +206 -206
  94. package/src/utils/sharepoint.rest/location.ts +141 -141
  95. package/src/utils/sharepoint.rest/navigation-links.ts +86 -86
  96. package/src/utils/sharepoint.rest/user-search.ts +252 -252
  97. package/src/utils/sharepoint.rest/user.ts +491 -491
  98. package/src/utils/sharepoint.rest/web.ts +1384 -1384
  99. package/src/utils/sod.ts +194 -194
@@ -1,150 +1,150 @@
1
- /* eslint-disable */
2
-
3
- /*! (c) 2020 Andrea Giammarchi */
4
-
5
- import { IFlatted } from "../types/flatted.types";
6
- import { isNullOrEmptyArray } from "./typecheckers";
7
-
8
- /** Version 3.2.9 */
9
- /**
10
- * Fast and minimal circular JSON parser.
11
- * logic example
12
- ```js
13
- var a = [{one: 1}, {two: '2'}];
14
- a[0].a = a;
15
- // a is the main object, will be at index '0'
16
- // {one: 1} is the second object, index '1'
17
- // {two: '2'} the third, in '2', and it has a string
18
- // which will be found at index '3'
19
- Flatted.stringify(a);
20
- // [["1","2"],{"one":1,"a":"0"},{"two":"3"},"2"]
21
- // a[one,two] {one: 1, a} {two: '2'} '2'
22
- ```
23
- */
24
- const { parse: $parse, stringify: $stringify } = JSON;
25
- const { keys } = Object;
26
-
27
- const Primitive = String; // it could be Number
28
- const primitive = 'string'; // it could be 'number'
29
-
30
- const ignore = {};
31
- const object = 'object';
32
-
33
- const noop = (_, value) => value;
34
-
35
- const primitives = value => (
36
- value instanceof Primitive ? Primitive(value) : value
37
- );
38
-
39
- const Primitives = (_, value) => (
40
- typeof value === primitive ? new Primitive(value) : value
41
- );
42
-
43
- const revive = (input, parsed, output, $) => {
44
- const lazy = [];
45
- for (let ke = keys(output), { length } = ke, y = 0; y < length; y++) {
46
- const k = ke[y];
47
- const value = output[k];
48
- if (value instanceof Primitive) {
49
- const tmp = input[value as string];
50
- if (typeof tmp === object && !parsed.has(tmp)) {
51
- parsed.add(tmp);
52
- output[k] = ignore;
53
- lazy.push({ k, a: [input, parsed, tmp, $] });
54
- }
55
- else
56
- output[k] = $.call(output, k, tmp);
57
- }
58
- else if (output[k] !== ignore)
59
- output[k] = $.call(output, k, value);
60
- }
61
- for (let { length } = lazy, i = 0; i < length; i++) {
62
- const { k, a } = lazy[i];
63
- output[k] = $.call(output, k, revive.apply(null, a));
64
- }
65
- return output;
66
- };
67
-
68
- const set = (known, input, value) => {
69
- const index = Primitive(input.push(value) - 1);
70
- known.set(value, index);
71
- return index;
72
- };
73
-
74
- const parse = (text, reviver?) => {
75
- const input = $parse(text, Primitives).map(primitives);
76
- const value = input[0];
77
- const $ = reviver || noop;
78
- const tmp = typeof value === object && value ?
79
- revive(input, new Set, value, $) :
80
- value;
81
- return $.call({ '': tmp }, '', tmp);
82
- };
83
- //exports.parse = parse;
84
-
85
- const stringify = (value, replacer?, space?) => {
86
- const $ = replacer && typeof replacer === object ?
87
- (k, v) => (k === '' || -1 < replacer.indexOf(k) ? v : void 0) :
88
- (replacer || noop);
89
- const known = new Map;
90
- const input = [];
91
- const output = [];
92
- let i = +set(known, input, $.call({ '': value }, '', value));
93
- let firstRun = !i;
94
- while (i < input.length) {
95
- firstRun = true;
96
- output[i] = $stringify(input[i++], replace, space);
97
- }
98
- return '[' + output.join(',') + ']';
99
- function replace(key, value) {
100
- if (firstRun) {
101
- firstRun = !firstRun;
102
- return value;
103
- }
104
- const after = $.call(this, key, value);
105
- switch (typeof after) {
106
- case object:
107
- if (after === null) return after;
108
- return known.get(after) || set(known, input, after);
109
- case primitive:
110
- return known.get(after) || set(known, input, after);
111
- }
112
- return after;
113
- }
114
- };
115
- //exports.stringify = stringify;
116
-
117
- const toJSON = any => $parse(stringify(any));
118
- //exports.toJSON = toJSON;
119
- const fromJSON = any => parse($stringify(any));
120
- //exports.fromJSON = fromJSON;
121
-
122
-
123
- /*! (c) 2020 Andrea Giammarchi */
124
- /**
125
- * Fast and minimal circular JSON parser.
126
- * logic example
127
- ```js
128
- var a = [{one: 1}, {two: '2'}];
129
- a[0].a = a;
130
- // a is the main object, will be at index '0'
131
- // {one: 1} is the second object, index '1'
132
- // {two: '2'} the third, in '2', and it has a string
133
- // which will be found at index '3'
134
- Flatted.stringify(a);
135
- // [["1","2"],{"one":1,"a":"0"},{"two":"3"},"2"]
136
- // a[one,two] {one: 1, a} {two: '2'} '2'
137
- ```
138
- */
139
- export var flatted: IFlatted = {
140
- toJSON: toJSON,
141
- fromJSON: fromJSON,
142
- stringify: stringify,
143
- parse: parse
144
- };
145
-
146
- export function flattedClone<T>(obj: T): T {
147
- if (isNullOrEmptyArray(obj)) return obj;
148
- //json clone won't work on circular object. must use flatted.
149
- return flatted.parse(flatted.stringify(obj));
1
+ /* eslint-disable */
2
+
3
+ /*! (c) 2020 Andrea Giammarchi */
4
+
5
+ import { IFlatted } from "../types/flatted.types";
6
+ import { isNullOrEmptyArray } from "./typecheckers";
7
+
8
+ /** Version 3.2.9 */
9
+ /**
10
+ * Fast and minimal circular JSON parser.
11
+ * logic example
12
+ ```js
13
+ var a = [{one: 1}, {two: '2'}];
14
+ a[0].a = a;
15
+ // a is the main object, will be at index '0'
16
+ // {one: 1} is the second object, index '1'
17
+ // {two: '2'} the third, in '2', and it has a string
18
+ // which will be found at index '3'
19
+ Flatted.stringify(a);
20
+ // [["1","2"],{"one":1,"a":"0"},{"two":"3"},"2"]
21
+ // a[one,two] {one: 1, a} {two: '2'} '2'
22
+ ```
23
+ */
24
+ const { parse: $parse, stringify: $stringify } = JSON;
25
+ const { keys } = Object;
26
+
27
+ const Primitive = String; // it could be Number
28
+ const primitive = 'string'; // it could be 'number'
29
+
30
+ const ignore = {};
31
+ const object = 'object';
32
+
33
+ const noop = (_, value) => value;
34
+
35
+ const primitives = value => (
36
+ value instanceof Primitive ? Primitive(value) : value
37
+ );
38
+
39
+ const Primitives = (_, value) => (
40
+ typeof value === primitive ? new Primitive(value) : value
41
+ );
42
+
43
+ const revive = (input, parsed, output, $) => {
44
+ const lazy = [];
45
+ for (let ke = keys(output), { length } = ke, y = 0; y < length; y++) {
46
+ const k = ke[y];
47
+ const value = output[k];
48
+ if (value instanceof Primitive) {
49
+ const tmp = input[value as string];
50
+ if (typeof tmp === object && !parsed.has(tmp)) {
51
+ parsed.add(tmp);
52
+ output[k] = ignore;
53
+ lazy.push({ k, a: [input, parsed, tmp, $] });
54
+ }
55
+ else
56
+ output[k] = $.call(output, k, tmp);
57
+ }
58
+ else if (output[k] !== ignore)
59
+ output[k] = $.call(output, k, value);
60
+ }
61
+ for (let { length } = lazy, i = 0; i < length; i++) {
62
+ const { k, a } = lazy[i];
63
+ output[k] = $.call(output, k, revive.apply(null, a));
64
+ }
65
+ return output;
66
+ };
67
+
68
+ const set = (known, input, value) => {
69
+ const index = Primitive(input.push(value) - 1);
70
+ known.set(value, index);
71
+ return index;
72
+ };
73
+
74
+ const parse = (text, reviver?) => {
75
+ const input = $parse(text, Primitives).map(primitives);
76
+ const value = input[0];
77
+ const $ = reviver || noop;
78
+ const tmp = typeof value === object && value ?
79
+ revive(input, new Set, value, $) :
80
+ value;
81
+ return $.call({ '': tmp }, '', tmp);
82
+ };
83
+ //exports.parse = parse;
84
+
85
+ const stringify = (value, replacer?, space?) => {
86
+ const $ = replacer && typeof replacer === object ?
87
+ (k, v) => (k === '' || -1 < replacer.indexOf(k) ? v : void 0) :
88
+ (replacer || noop);
89
+ const known = new Map;
90
+ const input = [];
91
+ const output = [];
92
+ let i = +set(known, input, $.call({ '': value }, '', value));
93
+ let firstRun = !i;
94
+ while (i < input.length) {
95
+ firstRun = true;
96
+ output[i] = $stringify(input[i++], replace, space);
97
+ }
98
+ return '[' + output.join(',') + ']';
99
+ function replace(key, value) {
100
+ if (firstRun) {
101
+ firstRun = !firstRun;
102
+ return value;
103
+ }
104
+ const after = $.call(this, key, value);
105
+ switch (typeof after) {
106
+ case object:
107
+ if (after === null) return after;
108
+ return known.get(after) || set(known, input, after);
109
+ case primitive:
110
+ return known.get(after) || set(known, input, after);
111
+ }
112
+ return after;
113
+ }
114
+ };
115
+ //exports.stringify = stringify;
116
+
117
+ const toJSON = any => $parse(stringify(any));
118
+ //exports.toJSON = toJSON;
119
+ const fromJSON = any => parse($stringify(any));
120
+ //exports.fromJSON = fromJSON;
121
+
122
+
123
+ /*! (c) 2020 Andrea Giammarchi */
124
+ /**
125
+ * Fast and minimal circular JSON parser.
126
+ * logic example
127
+ ```js
128
+ var a = [{one: 1}, {two: '2'}];
129
+ a[0].a = a;
130
+ // a is the main object, will be at index '0'
131
+ // {one: 1} is the second object, index '1'
132
+ // {two: '2'} the third, in '2', and it has a string
133
+ // which will be found at index '3'
134
+ Flatted.stringify(a);
135
+ // [["1","2"],{"one":1,"a":"0"},{"two":"3"},"2"]
136
+ // a[one,two] {one: 1, a} {two: '2'} '2'
137
+ ```
138
+ */
139
+ export var flatted: IFlatted = {
140
+ toJSON: toJSON,
141
+ fromJSON: fromJSON,
142
+ stringify: stringify,
143
+ parse: parse
144
+ };
145
+
146
+ export function flattedClone<T>(obj: T): T {
147
+ if (isNullOrEmptyArray(obj)) return obj;
148
+ //json clone won't work on circular object. must use flatted.
149
+ return flatted.parse(flatted.stringify(obj));
150
150
  }
@@ -1,17 +1,17 @@
1
- import { isFunction } from "./typecheckers";
2
-
3
- export function wrapFunction<ValueType, ReturnType>(f: (value: ValueType) => ReturnType, props: {
4
- before?: (value: ValueType) => ValueType;
5
- after?: (value: ValueType, returned: ReturnType) => void;
6
- }) {
7
- return (v: ValueType) => {
8
- if (isFunction(props.before)) {
9
- v = props.before(v);
10
- }
11
- let result = f(v);
12
- if (isFunction(props.after))
13
- props.after(v, result);
14
-
15
- return result;
16
- };
1
+ import { isFunction } from "./typecheckers";
2
+
3
+ export function wrapFunction<ValueType, ReturnType>(f: (value: ValueType) => ReturnType, props: {
4
+ before?: (value: ValueType) => ValueType;
5
+ after?: (value: ValueType, returned: ReturnType) => void;
6
+ }) {
7
+ return (v: ValueType) => {
8
+ if (isFunction(props.before)) {
9
+ v = props.before(v);
10
+ }
11
+ let result = f(v);
12
+ if (isFunction(props.after))
13
+ props.after(v, result);
14
+
15
+ return result;
16
+ };
17
17
  }
@@ -1,11 +1,11 @@
1
- import { IGraphEventAttendee, IGraphEventUser } from "../../types/graph/calendar.types";
2
- import { isNullOrEmptyString } from "../typecheckers";
3
-
4
- export function IsGraphEventUser(obj: any): obj is IGraphEventUser {
5
- let asEA = obj as IGraphEventUser;
6
- return asEA && asEA.emailAddress && !isNullOrEmptyString(asEA.emailAddress.address);
7
- }
8
- export function IsGraphEventAttendee(obj: any): obj is IGraphEventAttendee {
9
- let asEA = obj as IGraphEventAttendee;
10
- return IsGraphEventUser(obj) && asEA.status && !isNullOrEmptyString(asEA.type);
1
+ import { IGraphEventAttendee, IGraphEventUser } from "../../types/graph/calendar.types";
2
+ import { isNullOrEmptyString } from "../typecheckers";
3
+
4
+ export function IsGraphEventUser(obj: any): obj is IGraphEventUser {
5
+ let asEA = obj as IGraphEventUser;
6
+ return asEA && asEA.emailAddress && !isNullOrEmptyString(asEA.emailAddress.address);
7
+ }
8
+ export function IsGraphEventAttendee(obj: any): obj is IGraphEventAttendee {
9
+ let asEA = obj as IGraphEventAttendee;
10
+ return IsGraphEventUser(obj) && asEA.status && !isNullOrEmptyString(asEA.type);
11
11
  }
@@ -1,70 +1,70 @@
1
- import { objectValues } from "./objects";
2
- import { isNullOrUndefined } from "./typecheckers";
3
-
4
- // eslint-disable-next-line no-shadow
5
- export enum CommonHttpHeaderNames {
6
- Accept = "Accept",
7
- Authorization = "Authorization",
8
- ContentType = "content-type",
9
- XHTTPMethod = "X-HTTP-Method",
10
- XRapidApiHost = "x-rapidapi-host",
11
- XRapidApiKey = "x-rapidapi-key"
12
- }
13
-
14
- // eslint-disable-next-line no-shadow
15
- enum AcceptOrContentTypeHeaderValues {
16
- JsonVerbose = "application/json; odata=verbose",
17
- JsonMinimal = "application/json; odata=minimal",
18
- JsonNometadata = "application/json; odata=nometadata"
19
- }
20
-
21
- // eslint-disable-next-line no-shadow
22
- enum AuthorizationHeaderValues {
23
- Bearer = "Bearer [token]",
24
- Basic = "Basic [user]:[password]"
25
- }
26
-
27
- // eslint-disable-next-line no-shadow
28
- enum XHttpMethodHeaderValues {
29
- MERGE = "MERGE",
30
- DELETE = "DELETE",
31
- PUT = "PUT"
32
- }
33
-
34
- export function GetCommonHeaderNames() {
35
- return objectValues<CommonHttpHeaderNames>(CommonHttpHeaderNames);
36
- }
37
-
38
- export function GetCommonHeaderValueSuggestions(headerName: CommonHttpHeaderNames | string) {
39
- if (isNullOrUndefined(headerName)) {
40
- return [];
41
- }
42
-
43
- let parsedHeaderName = _getValueByKeyForStringEnum(headerName);
44
-
45
- if (isNullOrUndefined(parsedHeaderName)) {
46
- return [];
47
- }
48
-
49
- switch (parsedHeaderName) {
50
- case CommonHttpHeaderNames.Accept:
51
- case CommonHttpHeaderNames.ContentType:
52
- return objectValues<AcceptOrContentTypeHeaderValues>(AcceptOrContentTypeHeaderValues);
53
- case CommonHttpHeaderNames.Authorization:
54
- return objectValues<AuthorizationHeaderValues>(AuthorizationHeaderValues);
55
- case CommonHttpHeaderNames.XHTTPMethod:
56
- return objectValues<XHttpMethodHeaderValues>(XHttpMethodHeaderValues);
57
- default:
58
- return [];
59
- }
60
- }
61
-
62
- function _getValueByKeyForStringEnum(keyOrValue: string | CommonHttpHeaderNames) {
63
- let found = objectValues<CommonHttpHeaderNames>(CommonHttpHeaderNames).filter((value) => {
64
- return value === keyOrValue;
65
- })[0];
66
- if (isNullOrUndefined(found)) {
67
- found = CommonHttpHeaderNames[keyOrValue as keyof typeof CommonHttpHeaderNames];
68
- }
69
- return found;
1
+ import { objectValues } from "./objects";
2
+ import { isNullOrUndefined } from "./typecheckers";
3
+
4
+ // eslint-disable-next-line no-shadow
5
+ export enum CommonHttpHeaderNames {
6
+ Accept = "Accept",
7
+ Authorization = "Authorization",
8
+ ContentType = "content-type",
9
+ XHTTPMethod = "X-HTTP-Method",
10
+ XRapidApiHost = "x-rapidapi-host",
11
+ XRapidApiKey = "x-rapidapi-key"
12
+ }
13
+
14
+ // eslint-disable-next-line no-shadow
15
+ enum AcceptOrContentTypeHeaderValues {
16
+ JsonVerbose = "application/json; odata=verbose",
17
+ JsonMinimal = "application/json; odata=minimal",
18
+ JsonNometadata = "application/json; odata=nometadata"
19
+ }
20
+
21
+ // eslint-disable-next-line no-shadow
22
+ enum AuthorizationHeaderValues {
23
+ Bearer = "Bearer [token]",
24
+ Basic = "Basic [user]:[password]"
25
+ }
26
+
27
+ // eslint-disable-next-line no-shadow
28
+ enum XHttpMethodHeaderValues {
29
+ MERGE = "MERGE",
30
+ DELETE = "DELETE",
31
+ PUT = "PUT"
32
+ }
33
+
34
+ export function GetCommonHeaderNames() {
35
+ return objectValues<CommonHttpHeaderNames>(CommonHttpHeaderNames);
36
+ }
37
+
38
+ export function GetCommonHeaderValueSuggestions(headerName: CommonHttpHeaderNames | string) {
39
+ if (isNullOrUndefined(headerName)) {
40
+ return [];
41
+ }
42
+
43
+ let parsedHeaderName = _getValueByKeyForStringEnum(headerName);
44
+
45
+ if (isNullOrUndefined(parsedHeaderName)) {
46
+ return [];
47
+ }
48
+
49
+ switch (parsedHeaderName) {
50
+ case CommonHttpHeaderNames.Accept:
51
+ case CommonHttpHeaderNames.ContentType:
52
+ return objectValues<AcceptOrContentTypeHeaderValues>(AcceptOrContentTypeHeaderValues);
53
+ case CommonHttpHeaderNames.Authorization:
54
+ return objectValues<AuthorizationHeaderValues>(AuthorizationHeaderValues);
55
+ case CommonHttpHeaderNames.XHTTPMethod:
56
+ return objectValues<XHttpMethodHeaderValues>(XHttpMethodHeaderValues);
57
+ default:
58
+ return [];
59
+ }
60
+ }
61
+
62
+ function _getValueByKeyForStringEnum(keyOrValue: string | CommonHttpHeaderNames) {
63
+ let found = objectValues<CommonHttpHeaderNames>(CommonHttpHeaderNames).filter((value) => {
64
+ return value === keyOrValue;
65
+ })[0];
66
+ if (isNullOrUndefined(found)) {
67
+ found = CommonHttpHeaderNames[keyOrValue as keyof typeof CommonHttpHeaderNames];
68
+ }
69
+ return found;
70
70
  }
@@ -1,23 +1,23 @@
1
- const prefix = "https://apps.kwizcom.com/products/common/images/";
2
-
3
- export const LOGO_ANIM_SMALL = `${prefix}logo/anim-small.gif`;
4
- export const LOGO_ANIM = `${prefix}logo/anim.gif`;
5
-
6
- export const LOGO_BLACK_HORIZONTAL = `${prefix}logo/black/horizontal.png`;
7
- export const LOGO_BLACK_SQUARE = `${prefix}logo/black/square.png`;
8
- export const LOGO_BLACK_VERTICAL = `${prefix}logo/black/vertical.png`;
9
-
10
- export const LOGO_BLUE_HORIZONTAL = `${prefix}logo/blue/horizontal.png`;
11
- export const LOGO_BLUE_SQUARE = `${prefix}logo/blue/square.png`;
12
- export const LOGO_BLUE_VERTICAL = `${prefix}logo/blue/vertical.png`;
13
-
14
- export const LOGO_CYAN_HORIZONTAL = `${prefix}logo/cyan/horizontal.png`;
15
- export const LOGO_CYAN_VERTICAL = `${prefix}logo/cyan/vertical.png`;
16
-
17
- export const LOGO_GRAD_HORIZONTAL = `${prefix}logo/grad/horizontal.png`;
18
- export const LOGO_GRAD_SQUARE = `${prefix}logo/grad/square.png`;
19
- export const LOGO_GRAD_VERTICAL = `${prefix}logo/grad/vertical.png`;
20
-
21
- export const LOGO_WHITE_HORIZONTAL = `${prefix}logo/white/horizontal.png`;
22
- export const LOGO_WHITE_SQUARE = `${prefix}logo/white/square.png`;
1
+ const prefix = "https://apps.kwizcom.com/products/common/images/";
2
+
3
+ export const LOGO_ANIM_SMALL = `${prefix}logo/anim-small.gif`;
4
+ export const LOGO_ANIM = `${prefix}logo/anim.gif`;
5
+
6
+ export const LOGO_BLACK_HORIZONTAL = `${prefix}logo/black/horizontal.png`;
7
+ export const LOGO_BLACK_SQUARE = `${prefix}logo/black/square.png`;
8
+ export const LOGO_BLACK_VERTICAL = `${prefix}logo/black/vertical.png`;
9
+
10
+ export const LOGO_BLUE_HORIZONTAL = `${prefix}logo/blue/horizontal.png`;
11
+ export const LOGO_BLUE_SQUARE = `${prefix}logo/blue/square.png`;
12
+ export const LOGO_BLUE_VERTICAL = `${prefix}logo/blue/vertical.png`;
13
+
14
+ export const LOGO_CYAN_HORIZONTAL = `${prefix}logo/cyan/horizontal.png`;
15
+ export const LOGO_CYAN_VERTICAL = `${prefix}logo/cyan/vertical.png`;
16
+
17
+ export const LOGO_GRAD_HORIZONTAL = `${prefix}logo/grad/horizontal.png`;
18
+ export const LOGO_GRAD_SQUARE = `${prefix}logo/grad/square.png`;
19
+ export const LOGO_GRAD_VERTICAL = `${prefix}logo/grad/vertical.png`;
20
+
21
+ export const LOGO_WHITE_HORIZONTAL = `${prefix}logo/white/horizontal.png`;
22
+ export const LOGO_WHITE_SQUARE = `${prefix}logo/white/square.png`;
23
23
  export const LOGO_WHITE_VERTICAL = `${prefix}logo/white/vertical.png`;
@@ -1,39 +1,39 @@
1
- import { eval2 } from "./eval";
2
- import { isFunction, isNullOrEmptyString } from "./typecheckers";
3
-
4
- export function jsonParse<T = any>(str: string) {
5
- if (isNullOrEmptyString(str)) {
6
- return null;
7
- }
8
-
9
- if (JSON) {
10
- if (isFunction(JSON.parse)) {
11
- try {
12
- var v = JSON.parse(str);
13
- return v as T;
14
- } catch (ex) {
15
- return null;
16
- }
17
- }
18
- }
19
- try {
20
- var v2 = eval2("(" + str + ")");
21
-
22
- return v2 as T;
23
- } catch (ex1) {
24
- return null;
25
- }
26
- }
27
-
28
- /** stringify JSON object, but also sorts properties alphabetically */
29
- export function jsonStringify(obj: any, space?: number): string {
30
- if (isNullOrEmptyString(obj)) return "";
31
- var allKeys = [];
32
- JSON.stringify(obj, (key, value) => {
33
- if (!allKeys.includes(key))
34
- allKeys.push(key);
35
- return value;
36
- });
37
- allKeys.sort();
38
- return JSON.stringify(obj, allKeys, space);
1
+ import { eval2 } from "./eval";
2
+ import { isFunction, isNullOrEmptyString } from "./typecheckers";
3
+
4
+ export function jsonParse<T = any>(str: string) {
5
+ if (isNullOrEmptyString(str)) {
6
+ return null;
7
+ }
8
+
9
+ if (JSON) {
10
+ if (isFunction(JSON.parse)) {
11
+ try {
12
+ var v = JSON.parse(str);
13
+ return v as T;
14
+ } catch (ex) {
15
+ return null;
16
+ }
17
+ }
18
+ }
19
+ try {
20
+ var v2 = eval2("(" + str + ")");
21
+
22
+ return v2 as T;
23
+ } catch (ex1) {
24
+ return null;
25
+ }
26
+ }
27
+
28
+ /** stringify JSON object, but also sorts properties alphabetically */
29
+ export function jsonStringify(obj: any, space?: number): string {
30
+ if (isNullOrEmptyString(obj)) return "";
31
+ var allKeys = [];
32
+ JSON.stringify(obj, (key, value) => {
33
+ if (!allKeys.includes(key))
34
+ allKeys.push(key);
35
+ return value;
36
+ });
37
+ allKeys.sort();
38
+ return JSON.stringify(obj, allKeys, space);
39
39
  }