@kwiz/common 1.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.
Files changed (310) hide show
  1. package/LICENSE +21 -0
  2. package/dist/_dependencies.d.ts +1 -0
  3. package/dist/_dependencies.js +8 -0
  4. package/dist/_dependencies.js.map +1 -0
  5. package/dist/helpers/Guid.d.ts +119 -0
  6. package/dist/helpers/Guid.js +183 -0
  7. package/dist/helpers/Guid.js.map +1 -0
  8. package/dist/helpers/_dependencies.d.ts +2 -0
  9. package/dist/helpers/_dependencies.js +21 -0
  10. package/dist/helpers/_dependencies.js.map +1 -0
  11. package/dist/helpers/base64.d.ts +8 -0
  12. package/dist/helpers/base64.js +178 -0
  13. package/dist/helpers/base64.js.map +1 -0
  14. package/dist/helpers/browser.d.ts +144 -0
  15. package/dist/helpers/browser.js +1200 -0
  16. package/dist/helpers/browser.js.map +1 -0
  17. package/dist/helpers/browserinfo.d.ts +23 -0
  18. package/dist/helpers/browserinfo.js +215 -0
  19. package/dist/helpers/browserinfo.js.map +1 -0
  20. package/dist/helpers/collections.base.d.ts +128 -0
  21. package/dist/helpers/collections.base.js +430 -0
  22. package/dist/helpers/collections.base.js.map +1 -0
  23. package/dist/helpers/collections.d.ts +18 -0
  24. package/dist/helpers/collections.js +99 -0
  25. package/dist/helpers/collections.js.map +1 -0
  26. package/dist/helpers/color.d.ts +11 -0
  27. package/dist/helpers/color.js +57 -0
  28. package/dist/helpers/color.js.map +1 -0
  29. package/dist/helpers/cookies.d.ts +6 -0
  30. package/dist/helpers/cookies.js +56 -0
  31. package/dist/helpers/cookies.js.map +1 -0
  32. package/dist/helpers/date.d.ts +43 -0
  33. package/dist/helpers/date.js +158 -0
  34. package/dist/helpers/date.js.map +1 -0
  35. package/dist/helpers/debug.d.ts +33 -0
  36. package/dist/helpers/debug.js +177 -0
  37. package/dist/helpers/debug.js.map +1 -0
  38. package/dist/helpers/emails.d.ts +2 -0
  39. package/dist/helpers/emails.js +10 -0
  40. package/dist/helpers/emails.js.map +1 -0
  41. package/dist/helpers/eval.d.ts +1 -0
  42. package/dist/helpers/eval.js +10 -0
  43. package/dist/helpers/eval.js.map +1 -0
  44. package/dist/helpers/file.d.ts +11 -0
  45. package/dist/helpers/file.js +55 -0
  46. package/dist/helpers/file.js.map +1 -0
  47. package/dist/helpers/flatted.d.ts +20 -0
  48. package/dist/helpers/flatted.js +135 -0
  49. package/dist/helpers/flatted.js.map +1 -0
  50. package/dist/helpers/functions.d.ts +4 -0
  51. package/dist/helpers/functions.js +17 -0
  52. package/dist/helpers/functions.js.map +1 -0
  53. package/dist/helpers/graph/calendar.types.d.ts +3 -0
  54. package/dist/helpers/graph/calendar.types.js +15 -0
  55. package/dist/helpers/graph/calendar.types.js.map +1 -0
  56. package/dist/helpers/http.d.ts +25 -0
  57. package/dist/helpers/http.js +70 -0
  58. package/dist/helpers/http.js.map +1 -0
  59. package/dist/helpers/images.d.ts +16 -0
  60. package/dist/helpers/images.js +21 -0
  61. package/dist/helpers/images.js.map +1 -0
  62. package/dist/helpers/index.d.ts +29 -0
  63. package/dist/helpers/index.js +46 -0
  64. package/dist/helpers/index.js.map +1 -0
  65. package/dist/helpers/json.d.ts +3 -0
  66. package/dist/helpers/json.js +44 -0
  67. package/dist/helpers/json.js.map +1 -0
  68. package/dist/helpers/md5.d.ts +5 -0
  69. package/dist/helpers/md5.js +172 -0
  70. package/dist/helpers/md5.js.map +1 -0
  71. package/dist/helpers/objects.d.ts +49 -0
  72. package/dist/helpers/objects.js +271 -0
  73. package/dist/helpers/objects.js.map +1 -0
  74. package/dist/helpers/promises.d.ts +14 -0
  75. package/dist/helpers/promises.js +112 -0
  76. package/dist/helpers/promises.js.map +1 -0
  77. package/dist/helpers/random.d.ts +2 -0
  78. package/dist/helpers/random.js +32 -0
  79. package/dist/helpers/random.js.map +1 -0
  80. package/dist/helpers/scheduler/scheduler.d.ts +39 -0
  81. package/dist/helpers/scheduler/scheduler.js +109 -0
  82. package/dist/helpers/scheduler/scheduler.js.map +1 -0
  83. package/dist/helpers/sharepoint.d.ts +112 -0
  84. package/dist/helpers/sharepoint.js +629 -0
  85. package/dist/helpers/sharepoint.js.map +1 -0
  86. package/dist/helpers/strings.d.ts +56 -0
  87. package/dist/helpers/strings.js +282 -0
  88. package/dist/helpers/strings.js.map +1 -0
  89. package/dist/helpers/typecheckers.d.ts +56 -0
  90. package/dist/helpers/typecheckers.js +274 -0
  91. package/dist/helpers/typecheckers.js.map +1 -0
  92. package/dist/helpers/url.d.ts +46 -0
  93. package/dist/helpers/url.js +199 -0
  94. package/dist/helpers/url.js.map +1 -0
  95. package/dist/helpers/urlhelper.d.ts +16 -0
  96. package/dist/helpers/urlhelper.js +96 -0
  97. package/dist/helpers/urlhelper.js.map +1 -0
  98. package/dist/index.d.ts +15 -0
  99. package/dist/index.js +37 -0
  100. package/dist/index.js.map +1 -0
  101. package/dist/types/common.types.d.ts +19 -0
  102. package/dist/types/common.types.js +4 -0
  103. package/dist/types/common.types.js.map +1 -0
  104. package/dist/types/flatted.types.d.ts +49 -0
  105. package/dist/types/flatted.types.js +3 -0
  106. package/dist/types/flatted.types.js.map +1 -0
  107. package/dist/types/globals.types.d.ts +6 -0
  108. package/dist/types/globals.types.js +3 -0
  109. package/dist/types/globals.types.js.map +1 -0
  110. package/dist/types/graph/calendar.types.d.ts +79 -0
  111. package/dist/types/graph/calendar.types.js +3 -0
  112. package/dist/types/graph/calendar.types.js.map +1 -0
  113. package/dist/types/graph/index.d.ts +1 -0
  114. package/dist/types/graph/index.js +18 -0
  115. package/dist/types/graph/index.js.map +1 -0
  116. package/dist/types/index.d.ts +11 -0
  117. package/dist/types/index.js +28 -0
  118. package/dist/types/index.js.map +1 -0
  119. package/dist/types/knownscript.types.d.ts +22 -0
  120. package/dist/types/knownscript.types.js +3 -0
  121. package/dist/types/knownscript.types.js.map +1 -0
  122. package/dist/types/libs/datajs.types.d.ts +29 -0
  123. package/dist/types/libs/datajs.types.js +3 -0
  124. package/dist/types/libs/datajs.types.js.map +1 -0
  125. package/dist/types/libs/ics.types.d.ts +29 -0
  126. package/dist/types/libs/ics.types.js +3 -0
  127. package/dist/types/libs/ics.types.js.map +1 -0
  128. package/dist/types/libs/index.d.ts +3 -0
  129. package/dist/types/libs/index.js +20 -0
  130. package/dist/types/libs/index.js.map +1 -0
  131. package/dist/types/libs/msal.types.d.ts +33 -0
  132. package/dist/types/libs/msal.types.js +63 -0
  133. package/dist/types/libs/msal.types.js.map +1 -0
  134. package/dist/types/locales.d.ts +122 -0
  135. package/dist/types/locales.js +1 -0
  136. package/dist/types/locales.js.map +1 -0
  137. package/dist/types/localstoragecache.types.d.ts +8 -0
  138. package/dist/types/localstoragecache.types.js +3 -0
  139. package/dist/types/localstoragecache.types.js.map +1 -0
  140. package/dist/types/moment.d.ts +6 -0
  141. package/dist/types/moment.js +1 -0
  142. package/dist/types/moment.js.map +1 -0
  143. package/dist/types/regex.types.d.ts +14 -0
  144. package/dist/types/regex.types.js +3 -0
  145. package/dist/types/regex.types.js.map +1 -0
  146. package/dist/types/rest.types.d.ts +81 -0
  147. package/dist/types/rest.types.js +24 -0
  148. package/dist/types/rest.types.js.map +1 -0
  149. package/dist/types/sharepoint.types.d.ts +1432 -0
  150. package/dist/types/sharepoint.types.js +629 -0
  151. package/dist/types/sharepoint.types.js.map +1 -0
  152. package/dist/types/sharepoint.utils.types.d.ts +246 -0
  153. package/dist/types/sharepoint.utils.types.js +26 -0
  154. package/dist/types/sharepoint.utils.types.js.map +1 -0
  155. package/dist/utils/_dependencies.d.ts +3 -0
  156. package/dist/utils/_dependencies.js +24 -0
  157. package/dist/utils/_dependencies.js.map +1 -0
  158. package/dist/utils/base64.d.ts +2 -0
  159. package/dist/utils/base64.js +41 -0
  160. package/dist/utils/base64.js.map +1 -0
  161. package/dist/utils/consolelogger.d.ts +73 -0
  162. package/dist/utils/consolelogger.js +281 -0
  163. package/dist/utils/consolelogger.js.map +1 -0
  164. package/dist/utils/date.d.ts +10 -0
  165. package/dist/utils/date.js +30 -0
  166. package/dist/utils/date.js.map +1 -0
  167. package/dist/utils/emails.d.ts +2 -0
  168. package/dist/utils/emails.js +24 -0
  169. package/dist/utils/emails.js.map +1 -0
  170. package/dist/utils/index.d.ts +13 -0
  171. package/dist/utils/index.js +31 -0
  172. package/dist/utils/index.js.map +1 -0
  173. package/dist/utils/knownscript.d.ts +99 -0
  174. package/dist/utils/knownscript.js +261 -0
  175. package/dist/utils/knownscript.js.map +1 -0
  176. package/dist/utils/localstoragecache.d.ts +19 -0
  177. package/dist/utils/localstoragecache.js +372 -0
  178. package/dist/utils/localstoragecache.js.map +1 -0
  179. package/dist/utils/rest.d.ts +17 -0
  180. package/dist/utils/rest.js +402 -0
  181. package/dist/utils/rest.js.map +1 -0
  182. package/dist/utils/script.d.ts +33 -0
  183. package/dist/utils/script.js +169 -0
  184. package/dist/utils/script.js.map +1 -0
  185. package/dist/utils/sharepoint.rest/common.d.ts +32 -0
  186. package/dist/utils/sharepoint.rest/common.js +146 -0
  187. package/dist/utils/sharepoint.rest/common.js.map +1 -0
  188. package/dist/utils/sharepoint.rest/date.d.ts +2 -0
  189. package/dist/utils/sharepoint.rest/date.js +57 -0
  190. package/dist/utils/sharepoint.rest/date.js.map +1 -0
  191. package/dist/utils/sharepoint.rest/file.folder.d.ts +58 -0
  192. package/dist/utils/sharepoint.rest/file.folder.js +305 -0
  193. package/dist/utils/sharepoint.rest/file.folder.js.map +1 -0
  194. package/dist/utils/sharepoint.rest/index.d.ts +11 -0
  195. package/dist/utils/sharepoint.rest/index.js +28 -0
  196. package/dist/utils/sharepoint.rest/index.js.map +1 -0
  197. package/dist/utils/sharepoint.rest/item.d.ts +81 -0
  198. package/dist/utils/sharepoint.rest/item.js +444 -0
  199. package/dist/utils/sharepoint.rest/item.js.map +1 -0
  200. package/dist/utils/sharepoint.rest/list.d.ts +228 -0
  201. package/dist/utils/sharepoint.rest/list.js +868 -0
  202. package/dist/utils/sharepoint.rest/list.js.map +1 -0
  203. package/dist/utils/sharepoint.rest/listutils/GetListItemsByCaml.d.ts +19 -0
  204. package/dist/utils/sharepoint.rest/listutils/GetListItemsByCaml.js +629 -0
  205. package/dist/utils/sharepoint.rest/listutils/GetListItemsByCaml.js.map +1 -0
  206. package/dist/utils/sharepoint.rest/listutils/GetListItemsById.d.ts +14 -0
  207. package/dist/utils/sharepoint.rest/listutils/GetListItemsById.js +222 -0
  208. package/dist/utils/sharepoint.rest/listutils/GetListItemsById.js.map +1 -0
  209. package/dist/utils/sharepoint.rest/listutils/common.d.ts +3 -0
  210. package/dist/utils/sharepoint.rest/listutils/common.js +198 -0
  211. package/dist/utils/sharepoint.rest/listutils/common.js.map +1 -0
  212. package/dist/utils/sharepoint.rest/user-search.d.ts +76 -0
  213. package/dist/utils/sharepoint.rest/user-search.js +239 -0
  214. package/dist/utils/sharepoint.rest/user-search.js.map +1 -0
  215. package/dist/utils/sharepoint.rest/user.d.ts +71 -0
  216. package/dist/utils/sharepoint.rest/user.js +404 -0
  217. package/dist/utils/sharepoint.rest/user.js.map +1 -0
  218. package/dist/utils/sharepoint.rest/web.d.ts +107 -0
  219. package/dist/utils/sharepoint.rest/web.js +929 -0
  220. package/dist/utils/sharepoint.rest/web.js.map +1 -0
  221. package/dist/utils/sod.d.ts +29 -0
  222. package/dist/utils/sod.js +177 -0
  223. package/dist/utils/sod.js.map +1 -0
  224. package/package.json +60 -0
  225. package/readme.md +13 -0
  226. package/src/_dependencies.ts +2 -0
  227. package/src/helpers/Guid.ts +182 -0
  228. package/src/helpers/_dependencies.ts +3 -0
  229. package/src/helpers/base64.ts +174 -0
  230. package/src/helpers/browser.test.js +9 -0
  231. package/src/helpers/browser.ts +1299 -0
  232. package/src/helpers/browserinfo.ts +293 -0
  233. package/src/helpers/collections.base.test.js +26 -0
  234. package/src/helpers/collections.base.ts +439 -0
  235. package/src/helpers/collections.ts +108 -0
  236. package/src/helpers/color.ts +55 -0
  237. package/src/helpers/cookies.ts +55 -0
  238. package/src/helpers/date.test.js +97 -0
  239. package/src/helpers/date.ts +163 -0
  240. package/src/helpers/debug.ts +187 -0
  241. package/src/helpers/emails.ts +7 -0
  242. package/src/helpers/eval.ts +5 -0
  243. package/src/helpers/file.test.js +51 -0
  244. package/src/helpers/file.ts +59 -0
  245. package/src/helpers/flatted.ts +150 -0
  246. package/src/helpers/functions.ts +17 -0
  247. package/src/helpers/graph/calendar.types.ts +11 -0
  248. package/src/helpers/http.ts +70 -0
  249. package/src/helpers/images.ts +23 -0
  250. package/src/helpers/index.ts +29 -0
  251. package/src/helpers/json.ts +39 -0
  252. package/src/helpers/md5.ts +190 -0
  253. package/src/helpers/objects.test.js +27 -0
  254. package/src/helpers/objects.ts +256 -0
  255. package/src/helpers/promises.test.js +18 -0
  256. package/src/helpers/promises.ts +102 -0
  257. package/src/helpers/random.ts +27 -0
  258. package/src/helpers/scheduler/scheduler.test.js +104 -0
  259. package/src/helpers/scheduler/scheduler.ts +132 -0
  260. package/src/helpers/sharepoint.ts +681 -0
  261. package/src/helpers/strings.test.js +43 -0
  262. package/src/helpers/strings.ts +288 -0
  263. package/src/helpers/typecheckers.test.js +35 -0
  264. package/src/helpers/typecheckers.ts +263 -0
  265. package/src/helpers/url.test.js +18 -0
  266. package/src/helpers/url.ts +202 -0
  267. package/src/helpers/urlhelper.ts +104 -0
  268. package/src/index.ts +24 -0
  269. package/src/types/common.types.ts +16 -0
  270. package/src/types/flatted.types.ts +60 -0
  271. package/src/types/globals.types.ts +7 -0
  272. package/src/types/graph/calendar.types.ts +81 -0
  273. package/src/types/graph/index.ts +1 -0
  274. package/src/types/index.ts +12 -0
  275. package/src/types/knownscript.types.ts +19 -0
  276. package/src/types/libs/datajs.types.ts +29 -0
  277. package/src/types/libs/ics.types.ts +31 -0
  278. package/src/types/libs/index.ts +4 -0
  279. package/src/types/libs/msal.types.ts +79 -0
  280. package/src/types/locales.ts +125 -0
  281. package/src/types/localstoragecache.types.ts +9 -0
  282. package/src/types/moment.ts +7 -0
  283. package/src/types/regex.types.ts +17 -0
  284. package/src/types/rest.types.ts +94 -0
  285. package/src/types/sharepoint.types.ts +1413 -0
  286. package/src/types/sharepoint.utils.types.ts +246 -0
  287. package/src/utils/_dependencies.ts +4 -0
  288. package/src/utils/base64.ts +27 -0
  289. package/src/utils/consolelogger.ts +315 -0
  290. package/src/utils/date.ts +36 -0
  291. package/src/utils/emails.ts +25 -0
  292. package/src/utils/index.ts +13 -0
  293. package/src/utils/knownscript.ts +280 -0
  294. package/src/utils/localstoragecache.ts +419 -0
  295. package/src/utils/rest.ts +465 -0
  296. package/src/utils/script.ts +168 -0
  297. package/src/utils/sharepoint.rest/common.ts +149 -0
  298. package/src/utils/sharepoint.rest/date.ts +61 -0
  299. package/src/utils/sharepoint.rest/file.folder.ts +368 -0
  300. package/src/utils/sharepoint.rest/index.ts +11 -0
  301. package/src/utils/sharepoint.rest/item.ts +456 -0
  302. package/src/utils/sharepoint.rest/list.ts +1144 -0
  303. package/src/utils/sharepoint.rest/listutils/GetListItemsByCaml.ts +750 -0
  304. package/src/utils/sharepoint.rest/listutils/GetListItemsById.ts +265 -0
  305. package/src/utils/sharepoint.rest/listutils/common.ts +202 -0
  306. package/src/utils/sharepoint.rest/user-search.ts +254 -0
  307. package/src/utils/sharepoint.rest/user.ts +447 -0
  308. package/src/utils/sharepoint.rest/web.ts +1031 -0
  309. package/src/utils/sod.ts +193 -0
  310. package/tsconfig.json +21 -0
@@ -0,0 +1,56 @@
1
+ import { IDictionary } from "./_dependencies";
2
+ export declare function endsWith(str: string, value: string, ignoreCase?: boolean): boolean;
3
+ export declare function startsWith(str: string, value: string, ignoreCase?: boolean): boolean;
4
+ /** remove space at start or end */
5
+ export declare function trim(str: string): string;
6
+ export declare function trimEnd(str: string): string;
7
+ export declare function trimStart(str: string): string;
8
+ export declare function splice(str: string, start: number, delCount: number, insert: string): string;
9
+ export declare function padRight(value: string | number, length: number, fillString?: string): string;
10
+ export declare function padLeft(value: string | number, length: number, fillString?: string): string;
11
+ /** returns array of [token] found inside the string
12
+ * supports token formats [Author??Created by {0}::Unknown author] will return "Author" as the token
13
+ * */
14
+ export declare function GetTokens(StringFormat: string): string[];
15
+ /** replaces a string with [token] and [otherToken] with their matched provided values
16
+ * supports token formats [Author??Created by {0}::Unknown author]
17
+ */
18
+ export declare function ReplaceTokens(StringFormat: string, TokenValues: IDictionary<string>, options?: {
19
+ /**set to true if you want to keep "[token]" in the string when a token value wasn't provided */
20
+ keepMissingTokens?: boolean;
21
+ }): string;
22
+ /** Normalizes a guid string, lower case and removes {} */
23
+ export declare function normalizeGuid(text: string, removeDashes?: boolean): string;
24
+ export declare function isEmptyGuid(guid: {
25
+ toString(): string;
26
+ }): boolean;
27
+ export declare function escapeRegExp(text: string): string;
28
+ export declare function isValidDomainLogin(login: string): boolean;
29
+ export declare function stripRichTextWhitespace(value: string): string;
30
+ /** allows min length 1, letters, numbers underscore only */
31
+ export declare function isValidVarName(text: string): boolean;
32
+ /** allows min length 1, letters, numbers underscore and hyphen only */
33
+ export declare function isValidHeaderName(text: string): boolean;
34
+ /** returns token info with format */
35
+ export declare function GetTokenInfo(text: string): {
36
+ tokenName: string;
37
+ hasFormat: boolean;
38
+ getValue: (value: string) => string;
39
+ };
40
+ /** return true if both strings are the same, or both are empty/null/undefined */
41
+ export declare function stringEqualsOrEmpty(str1: string, str2: string, ignoreCase?: boolean): boolean;
42
+ /** return true if str1 contains str2 */
43
+ export declare function stringContains(str1: string, str2: string, ignoreCase?: boolean): boolean;
44
+ export declare function cleanupString(str: string, options: {
45
+ replaceNewLines?: string;
46
+ collapseMultipleSpaces?: string;
47
+ collapseMultipleDashes?: string;
48
+ collapseMultipleUnderscore?: string;
49
+ }): string;
50
+ /** normalizes &#160; to &nbsp; see Issue 752 */
51
+ export declare function normalizeHtmlSpace(html: string): string;
52
+ export declare function replaceAll(str: string, find: string, replace: string, ignoreCase?: boolean): string;
53
+ export declare function capitalizeFirstLetter(str: string): string;
54
+ export declare function escapeXml(unsafe: string, isAttribute?: boolean): string;
55
+ /** uses regex str.match to replace each match by calling the replacer function (imported from CMS) */
56
+ export declare function replaceRegex(str: string, regex: RegExp, replacer: (match: string) => string | null): string;
@@ -0,0 +1,282 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.replaceRegex = exports.escapeXml = exports.capitalizeFirstLetter = exports.replaceAll = exports.normalizeHtmlSpace = exports.cleanupString = exports.stringContains = exports.stringEqualsOrEmpty = exports.GetTokenInfo = exports.isValidHeaderName = exports.isValidVarName = exports.stripRichTextWhitespace = exports.isValidDomainLogin = exports.escapeRegExp = exports.isEmptyGuid = exports.normalizeGuid = exports.ReplaceTokens = exports.GetTokens = exports.padLeft = exports.padRight = exports.splice = exports.trimStart = exports.trimEnd = exports.trim = exports.startsWith = exports.endsWith = void 0;
4
+ const collections_base_1 = require("./collections.base");
5
+ const typecheckers_1 = require("./typecheckers");
6
+ function endsWith(str, value, ignoreCase) {
7
+ let str1 = str;
8
+ let find = value;
9
+ if (ignoreCase) {
10
+ str1 = str1.toLowerCase();
11
+ find = find.toLowerCase();
12
+ }
13
+ return str1.substr(str1.length - find.length) === find;
14
+ }
15
+ exports.endsWith = endsWith;
16
+ function startsWith(str, value, ignoreCase) {
17
+ let str1 = str;
18
+ let find = value;
19
+ if (ignoreCase) {
20
+ str1 = str1.toLowerCase();
21
+ find = find.toLowerCase();
22
+ }
23
+ return str1.substr(0, find.length) === find;
24
+ }
25
+ exports.startsWith = startsWith;
26
+ /** remove space at start or end */
27
+ function trim(str) {
28
+ return str.replace(/^\s+|\s+$/g, '');
29
+ }
30
+ exports.trim = trim;
31
+ function trimEnd(str) {
32
+ return str.replace(/\s+$/, "");
33
+ }
34
+ exports.trimEnd = trimEnd;
35
+ function trimStart(str) {
36
+ return str.replace(/^\s+/, "");
37
+ }
38
+ exports.trimStart = trimStart;
39
+ function splice(str, start, delCount, insert) {
40
+ return str.slice(0, start) + insert + str.slice(start + Math.abs(delCount));
41
+ }
42
+ exports.splice = splice;
43
+ function padRight(value, length, fillString = "0") {
44
+ if ((0, typecheckers_1.isNumber)(value))
45
+ value = value.toString(10);
46
+ let pad = (0, typecheckers_1.isNullOrEmptyString)(fillString) ? "0" : fillString[0];
47
+ return value + Array(length - value.length + 1).join(pad);
48
+ }
49
+ exports.padRight = padRight;
50
+ function padLeft(value, length, fillString = "0") {
51
+ if ((0, typecheckers_1.isNumber)(value))
52
+ value = value.toString(10);
53
+ let pad = (0, typecheckers_1.isNullOrEmptyString)(fillString) ? "0" : fillString[0];
54
+ return Array(length - String(value).length + 1).join(pad) + value;
55
+ }
56
+ exports.padLeft = padLeft;
57
+ /** returns array of [token] found inside the string
58
+ * supports token formats [Author??Created by {0}::Unknown author] will return "Author" as the token
59
+ * */
60
+ function GetTokens(StringFormat) {
61
+ let tokensResult = [];
62
+ if ((0, typecheckers_1.isNullOrEmptyString)(StringFormat))
63
+ return tokensResult;
64
+ let tokens = StringFormat.match(/\[[^\]]*\]/g);
65
+ if (tokens && tokens.length > 0) {
66
+ tokens.forEach(token => {
67
+ let key = token.slice(1, token.length - 1);
68
+ key = GetTokenInfo(key).tokenName;
69
+ if (tokensResult.indexOf(key) < 0)
70
+ tokensResult.push(key);
71
+ });
72
+ }
73
+ return tokensResult;
74
+ }
75
+ exports.GetTokens = GetTokens;
76
+ /** replaces a string with [token] and [otherToken] with their matched provided values
77
+ * supports token formats [Author??Created by {0}::Unknown author]
78
+ */
79
+ function ReplaceTokens(StringFormat, TokenValues, options) {
80
+ let skipMissingTokens = options && options.keepMissingTokens;
81
+ if ((0, typecheckers_1.isNullOrUndefined)(StringFormat))
82
+ return null;
83
+ if (StringFormat !== '') {
84
+ let tokens = StringFormat.match(/\[[^\]]*\]/g);
85
+ if (tokens && tokens.length > 0) {
86
+ if ((0, typecheckers_1.isNullOrUndefined)(TokenValues))
87
+ TokenValues = {};
88
+ tokens.forEach(token => {
89
+ let key = token.slice(1, token.length - 1);
90
+ let tokenInfo = GetTokenInfo(key);
91
+ let value = TokenValues[tokenInfo.tokenName];
92
+ let skip = false;
93
+ if ((0, typecheckers_1.isNullOrUndefined)(value)) {
94
+ value = "";
95
+ skip = skipMissingTokens; //if true we won't replace this one
96
+ }
97
+ if (!skip || tokenInfo.hasFormat)
98
+ StringFormat = StringFormat.replace(token, tokenInfo.getValue(value));
99
+ });
100
+ }
101
+ }
102
+ return StringFormat;
103
+ }
104
+ exports.ReplaceTokens = ReplaceTokens;
105
+ /** Normalizes a guid string, lower case and removes {} */
106
+ function normalizeGuid(text, removeDashes) {
107
+ if ((0, typecheckers_1.isNullOrEmptyString)(text) || !(0, typecheckers_1.isString)(text)) {
108
+ return text;
109
+ }
110
+ var guid = text.toLowerCase().trim();
111
+ if (guid.startsWith("{")) {
112
+ guid = guid.substr(1);
113
+ }
114
+ if (guid.endsWith("}")) {
115
+ guid = guid.substr(0, guid.length - 1);
116
+ }
117
+ if (removeDashes) {
118
+ guid = guid.replace(/-/g, '');
119
+ }
120
+ return guid;
121
+ }
122
+ exports.normalizeGuid = normalizeGuid;
123
+ function isEmptyGuid(guid) {
124
+ if ((0, typecheckers_1.isNullOrEmptyString)(guid))
125
+ return true;
126
+ else if (Number(normalizeGuid(guid.toString(), true)) === 0)
127
+ return true;
128
+ return false;
129
+ }
130
+ exports.isEmptyGuid = isEmptyGuid;
131
+ function escapeRegExp(text) {
132
+ return text.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&');
133
+ }
134
+ exports.escapeRegExp = escapeRegExp;
135
+ function isValidDomainLogin(login) {
136
+ return /^[A-Za-z0-9\\._-]{7,}$/.test(login);
137
+ }
138
+ exports.isValidDomainLogin = isValidDomainLogin;
139
+ function stripRichTextWhitespace(value) {
140
+ // richText fields in have random markup even when field is empty
141
+ // \u200B zero width space
142
+ // \u200C zero width non-joiner Unicode code point
143
+ // \u200D zero width joiner Unicode code point
144
+ // \uFEFF zero width no-break space Unicode code point
145
+ return (0, typecheckers_1.isString)(value) ? value.replace(/[\u200B-\u200D\uFEFF]/g, "") : value;
146
+ }
147
+ exports.stripRichTextWhitespace = stripRichTextWhitespace;
148
+ /** allows min length 1, letters, numbers underscore only */
149
+ function isValidVarName(text) {
150
+ return /^[A-Za-z0-9_]{1,}$/.test(text);
151
+ }
152
+ exports.isValidVarName = isValidVarName;
153
+ /** allows min length 1, letters, numbers underscore and hyphen only */
154
+ function isValidHeaderName(text) {
155
+ return /^[A-Za-z0-9_-]{1,}$/.test(text);
156
+ }
157
+ exports.isValidHeaderName = isValidHeaderName;
158
+ /** returns token info with format */
159
+ function GetTokenInfo(text) {
160
+ let split = text.split('??');
161
+ let hasFormat = split.length > 0 && !(0, typecheckers_1.isNullOrEmptyString)(split[1]);
162
+ let formatSplit = hasFormat ? split[1].split('::') : [];
163
+ let valueIfEmpty = formatSplit.length > 1 ? formatSplit[1] : "";
164
+ let formatIfNotEmpty = formatSplit[0];
165
+ let info = {
166
+ tokenName: hasFormat ? split[0] : text,
167
+ hasFormat: hasFormat,
168
+ getValue: (value) => {
169
+ if (!hasFormat)
170
+ return value;
171
+ else {
172
+ if ((0, typecheckers_1.isNullOrEmptyString)(value))
173
+ return valueIfEmpty;
174
+ else
175
+ return formatIfNotEmpty.replace('{0}', value);
176
+ }
177
+ }
178
+ };
179
+ return info;
180
+ }
181
+ exports.GetTokenInfo = GetTokenInfo;
182
+ /** return true if both strings are the same, or both are empty/null/undefined */
183
+ function stringEqualsOrEmpty(str1, str2, ignoreCase) {
184
+ if ((0, typecheckers_1.isNullOrEmptyString)(str1) && (0, typecheckers_1.isNullOrEmptyString)(str2))
185
+ return true;
186
+ if (ignoreCase) {
187
+ if (!(0, typecheckers_1.isNullOrEmptyString)(str1))
188
+ str1 = str1.toLowerCase();
189
+ if (!(0, typecheckers_1.isNullOrEmptyString)(str2))
190
+ str2 = str2.toLowerCase();
191
+ }
192
+ return str1 === str2;
193
+ }
194
+ exports.stringEqualsOrEmpty = stringEqualsOrEmpty;
195
+ /** return true if str1 contains str2 */
196
+ function stringContains(str1, str2, ignoreCase) {
197
+ if ((0, typecheckers_1.isNullOrEmptyString)(str1) && (0, typecheckers_1.isNullOrEmptyString)(str2))
198
+ return true;
199
+ if ((0, typecheckers_1.isNullOrEmptyString)(str1))
200
+ str1 = "";
201
+ if ((0, typecheckers_1.isNullOrEmptyString)(str2))
202
+ str2 = "";
203
+ if (ignoreCase) {
204
+ str1 = str1.toLowerCase();
205
+ str2 = str2.toLowerCase();
206
+ }
207
+ return str1.indexOf(str2) >= 0;
208
+ }
209
+ exports.stringContains = stringContains;
210
+ function cleanupString(str, options) {
211
+ if ((0, typecheckers_1.isString)(options.replaceNewLines))
212
+ str = str.replace(/\r/g, '') //no returns
213
+ .replace(/\n/g, options.replaceNewLines); //no line breaks
214
+ if ((0, typecheckers_1.isString)(options.collapseMultipleDashes))
215
+ str = str.replace(/-+/g, options.collapseMultipleSpaces); //no extra spaces
216
+ if ((0, typecheckers_1.isString)(options.collapseMultipleUnderscore))
217
+ str = str.replace(/_+/g, options.collapseMultipleUnderscore); //no extra spaces
218
+ // do this last, so it will collapse spaces added by previous options
219
+ if ((0, typecheckers_1.isString)(options.collapseMultipleSpaces)) {
220
+ str = str.replace(new RegExp(String.fromCharCode(160), "g"), '') //get rid of non-breaking spaces
221
+ .replace(/ +/g, options.collapseMultipleSpaces); //no extra spaces
222
+ }
223
+ return str;
224
+ }
225
+ exports.cleanupString = cleanupString;
226
+ /** normalizes &#160; to &nbsp; see Issue 752 */
227
+ function normalizeHtmlSpace(html) {
228
+ if ((0, typecheckers_1.isNullOrEmptyString)(html))
229
+ return html;
230
+ return html.replace(/&#160;/i, "&nbsp;");
231
+ }
232
+ exports.normalizeHtmlSpace = normalizeHtmlSpace;
233
+ function replaceAll(str, find, replace, ignoreCase = false) {
234
+ return str.replace(new RegExp(find, `g${ignoreCase ? 'i' : ''}`), replace);
235
+ }
236
+ exports.replaceAll = replaceAll;
237
+ function capitalizeFirstLetter(str) {
238
+ return (0, typecheckers_1.isNullOrEmptyString)(str)
239
+ ? ""
240
+ : `${str.charAt(0).toUpperCase()}${str.substring(1)}`;
241
+ }
242
+ exports.capitalizeFirstLetter = capitalizeFirstLetter;
243
+ function escapeXml(unsafe, isAttribute = false) {
244
+ if ((0, typecheckers_1.isNullOrEmptyString)(unsafe))
245
+ return "";
246
+ return isAttribute
247
+ ? unsafe.replace(/[<>&'"]/g, (c) => {
248
+ switch (c) {
249
+ case '<': return '&lt;';
250
+ case '>': return '&gt;';
251
+ case '&': return '&amp;';
252
+ case '\'': return '&apos;';
253
+ case '"': return '&quot;';
254
+ }
255
+ return c;
256
+ })
257
+ : unsafe.replace(/[<>&]/g, (c) => {
258
+ switch (c) {
259
+ case '<': return '&lt;';
260
+ case '>': return '&gt;';
261
+ case '&': return '&amp;';
262
+ }
263
+ return c;
264
+ });
265
+ }
266
+ exports.escapeXml = escapeXml;
267
+ /** uses regex str.match to replace each match by calling the replacer function (imported from CMS) */
268
+ function replaceRegex(str, regex, replacer) {
269
+ let matches = str.match(regex);
270
+ if (!matches || matches.length < 1)
271
+ return str;
272
+ //replace each found token only once
273
+ let unique = (0, collections_base_1.makeUniqueArray)(matches);
274
+ unique.forEach(m => {
275
+ let replacement = replacer(m);
276
+ if (!(0, typecheckers_1.isNullOrUndefined)(replacement)) //ignore nulls
277
+ str = replaceAll(str, m, replacement);
278
+ });
279
+ return str;
280
+ }
281
+ exports.replaceRegex = replaceRegex;
282
+ //# sourceMappingURL=strings.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"strings.js","sourceRoot":"","sources":["../../src/helpers/strings.ts"],"names":[],"mappings":";;;AACA,yDAAqD;AACrD,iDAA4F;AAE5F,SAAgB,QAAQ,CAAC,GAAW,EAAE,KAAa,EAAE,UAAoB;IACrE,IAAI,IAAI,GAAG,GAAG,CAAC;IACf,IAAI,IAAI,GAAG,KAAK,CAAC;IACjB,IAAI,UAAU,EAAE,CAAC;QACb,IAAI,GAAG,IAAI,CAAC,WAAW,EAAE,CAAC;QAC1B,IAAI,GAAG,IAA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OAAO,OAAO,CAAC;gBACzB,KAAK,IAAI,CAAC,CAAC,OAAO,QAAQ,CAAC;gBAC3B,KAAK,GAAG,CAAC,CAAC,OAAO,QAAQ,CAAC;YAC9B,CAAC;YACD,OAAO,CAAC,CAAC;QACb,CAAC,CAAC;QACF,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAC,EAAE,EAAE;YAC7B,QAAQ,CAAC,EAAE,CAAC;gBACR,KAAK,GAAG,CAAC,CAAC,OAAO,MAAM,CAAC;gBACxB,KAAK,GAAG,CAAC,CAAC,OAAO,MAAM,CAAC;gBACxB,KAAK,GAAG,CAAC,CAAC,OAAO,OAAO,CAAC;YAC7B,CAAC;YACD,OAAO,CAAC,CAAC;QACb,CAAC,CAAC,CAAC;AACX,CAAC;AArBD,8BAqBC;AAED,sGAAsG;AACtG,SAAgB,YAAY,CAAC,GAAW,EAAE,KAAa,EAAE,QAA0C;IAC/F,IAAI,OAAO,GAAG,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IAC/B,IAAI,CAAC,OAAO,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC;QAAE,OAAO,GAAG,CAAC;IAC/C,oCAAoC;IACpC,IAAI,MAAM,GAAG,IAAA,kCAAe,EAAC,OAAO,CAAC,CAAC;IACtC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE;QACf,IAAI,WAAW,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC;QAC9B,IAAI,CAAC,IAAA,gCAAiB,EAAC,WAAW,CAAC,EAAC,cAAc;YAC9C,GAAG,GAAG,UAAU,CAAC,GAAG,EAAE,CAAC,EAAE,WAAW,CAAC,CAAC;IAC9C,CAAC,CAAC,CAAC;IACH,OAAO,GAAG,CAAC;AACf,CAAC;AAXD,oCAWC"}
@@ -0,0 +1,56 @@
1
+ /** check if a global object in that full name exists and return its type or "undefined" */
2
+ export declare function typeofFullName(fullName: string, windowOrParent?: Window | any): "string" | "number" | "bigint" | "boolean" | "symbol" | "undefined" | "object" | "function";
3
+ /** get the value by full name of property */
4
+ export declare function getFromFullName<T>(fullName: string, windowOrParent?: Window | any): T;
5
+ export declare function isTypeofFullNameObject(fullName: string, windowOrParent?: Window | any): boolean;
6
+ export declare function isTypeofFullNameString(fullName: string, windowOrParent?: Window | any): boolean;
7
+ export declare function isTypeofFullNameNumber(fullName: string, windowOrParent?: Window | any): boolean;
8
+ export declare function isTypeofFullNameNullOrUndefined(fullName: string, windowOrParent?: Window | any): boolean;
9
+ export declare function isTypeofFullNameUndefined(fullName: string, windowOrParent?: Window | any): boolean;
10
+ export declare function isTypeofFullNameFunction(fullName: string, windowOrParent?: Window | any): boolean;
11
+ export declare function isTypeofFullNameBoolean(fullName: string, windowOrParent?: Window | any): boolean;
12
+ export declare function isType(obj: any, str: string): boolean;
13
+ export declare function isObject(obj: any): obj is object;
14
+ /** Checks if obj is empty - as primitive, array or object
15
+ * If an object, pass an optional array of keys to ignore
16
+ */
17
+ export declare function isEmptyObject(obj: any, options?: {
18
+ ignoreKeys?: string[];
19
+ }): boolean;
20
+ export declare function isNullOrUndefined(obj: any): boolean;
21
+ /** return true if o is undefined, null or not a number */
22
+ export declare function isNullOrNaN(o: any): boolean;
23
+ /** return true if o is undefined, null or empty string */
24
+ export declare function isNullOrEmptyString(o: any): o is null | undefined | "";
25
+ /** o is an array that is not empty (length > 0) */
26
+ export declare function isNotEmptyArray(o: any): o is any[];
27
+ /** o is undefined, null or an empty array */
28
+ export declare function isNullOrEmptyArray(o: any): boolean;
29
+ export declare function isString(obj: any): obj is string;
30
+ /** true if object is a Date object */
31
+ export declare function isDate(obj: any): obj is Date;
32
+ /** true if obj is a number or a numeric string */
33
+ export declare function isNumeric(obj: any): obj is number | string;
34
+ /** true if obj is a number */
35
+ export declare function isNumber(obj?: any): obj is number;
36
+ export declare function isNumberArray(obj: any[]): obj is number[];
37
+ export declare function isUndefined(obj: any): obj is undefined;
38
+ export declare function isFunction(obj: any): obj is Function;
39
+ export declare function isBoolean(obj: any): obj is boolean;
40
+ export declare function isPromise<t>(obj: any): obj is Promise<t>;
41
+ export type primitiveTypes = string | number | Date | boolean | null;
42
+ /**returns true if object is string, number, date, boolean value or null*/
43
+ export declare function isPrimitiveValue(obj: any): obj is primitiveTypes;
44
+ export declare function isValidGuid(str: string): boolean;
45
+ export declare var BoolTrueStrings: string[];
46
+ export declare var BoolFalseStrings: string[];
47
+ export declare function isTrueString(str: string, options?: {
48
+ allowPositiveNumbers?: boolean;
49
+ }): boolean;
50
+ export declare function newGuid(): string;
51
+ /** check if object has all members (they are not undefined) */
52
+ export declare function hasMembers(o: any, ...members: string[]): boolean;
53
+ /** compares 2 versions. if v1 is bigger return 1, if v2 is bigger returns -1, if equals return 0 */
54
+ export declare function CompareVersion(v1: string, v2: string): 0 | 1 | -1;
55
+ /** pass along a list of unsafe tests to get a value, the first one that doesn't throw an exception and doesnt return null will get returned */
56
+ export declare function SafeIfElse<T>(...list: ((() => T) | T)[]): T;