diginext-utils 2.1.20 → 2.1.21

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 (205) hide show
  1. package/dist/Checker.d.ts +8 -8
  2. package/dist/Checker.js +31 -31
  3. package/dist/EventDispatcher.d.ts +13 -13
  4. package/dist/EventDispatcher.js +51 -51
  5. package/dist/FileUpload.d.ts +12 -12
  6. package/dist/FileUpload.js +64 -64
  7. package/dist/Slug.d.ts +9 -9
  8. package/dist/Slug.js +333 -333
  9. package/dist/Timer.d.ts +4 -4
  10. package/dist/Timer.js +8 -8
  11. package/dist/Validation.d.ts +5 -5
  12. package/dist/Validation.js +38 -38
  13. package/dist/array.d.ts +113 -113
  14. package/dist/array.js +297 -297
  15. package/dist/color.d.ts +25 -25
  16. package/dist/color.js +95 -95
  17. package/dist/console/enableConsole.d.ts +2 -2
  18. package/dist/console/enableConsole.js +13 -13
  19. package/dist/console/index.d.ts +11 -11
  20. package/dist/console/index.js +17 -17
  21. package/dist/console/log.d.ts +15 -15
  22. package/dist/console/log.js +44 -44
  23. package/dist/device/browser.d.ts +5 -5
  24. package/dist/device/browser.js +37 -37
  25. package/dist/device/camera.d.ts +7 -7
  26. package/dist/device/camera.js +171 -171
  27. package/dist/device/index.d.ts +5 -5
  28. package/dist/device/index.js +224 -224
  29. package/dist/device/os.d.ts +11 -11
  30. package/dist/device/os.js +37 -37
  31. package/dist/file/createDir.d.ts +5 -5
  32. package/dist/file/createDir.js +15 -15
  33. package/dist/file/fileMove.d.ts +4 -4
  34. package/dist/file/fileMove.js +32 -32
  35. package/dist/file/findFilesByExt.d.ts +13 -13
  36. package/dist/file/findFilesByExt.js +49 -49
  37. package/dist/file/getAllFiles.d.ts +1 -0
  38. package/dist/file/getAllFiles.js +27 -0
  39. package/dist/file/getAllFiles.js.map +1 -0
  40. package/dist/file/index.d.ts +9 -9
  41. package/dist/file/index.js +10 -10
  42. package/dist/gameboi/index.d.ts +10 -10
  43. package/dist/gameboi/index.js +67 -64
  44. package/dist/gameboi/index.js.map +1 -1
  45. package/dist/images/downloadByUrl.d.ts +1 -1
  46. package/dist/images/downloadByUrl.js +55 -55
  47. package/dist/images/index.d.ts +2 -2
  48. package/dist/images/index.js +8 -8
  49. package/dist/images/loadImage.d.ts +1 -1
  50. package/dist/images/loadImage.js +17 -17
  51. package/dist/images/resize.d.ts +2 -2
  52. package/dist/images/resize.js +37 -37
  53. package/dist/images/upload.d.ts +10 -10
  54. package/dist/images/upload.js +26 -26
  55. package/dist/index.d.ts +37 -37
  56. package/dist/index.js +62 -62
  57. package/dist/json.d.ts +8 -8
  58. package/dist/json.js +31 -31
  59. package/dist/math/diffDate.d.ts +5 -5
  60. package/dist/math/diffDate.js +13 -13
  61. package/dist/math/index.d.ts +30 -30
  62. package/dist/math/index.js +92 -92
  63. package/dist/math/positiveNumber.d.ts +2 -2
  64. package/dist/math/positiveNumber.js +16 -16
  65. package/dist/name/en.d.ts +5 -5
  66. package/dist/name/en.js +25 -25
  67. package/dist/name/index.d.ts +12 -12
  68. package/dist/name/index.js +12 -12
  69. package/dist/name/vi.d.ts +5 -5
  70. package/dist/name/vi.js +27 -27
  71. package/dist/object.d.ts +59 -59
  72. package/dist/object.js +79 -79
  73. package/dist/permission/index.d.ts +8 -8
  74. package/dist/permission/index.js +6 -6
  75. package/dist/permission/requestCamera.d.ts +5 -5
  76. package/dist/permission/requestCamera.js +42 -42
  77. package/dist/permission/requestDeviceOrientationControl.d.ts +2 -2
  78. package/dist/permission/requestDeviceOrientationControl.js +38 -38
  79. package/dist/response/index.d.ts +49 -49
  80. package/dist/response/index.js +51 -51
  81. package/dist/string/convertPathnameAndQuery.d.ts +4 -4
  82. package/dist/string/convertPathnameAndQuery.js +24 -24
  83. package/dist/string/formatNumber.d.ts +6 -6
  84. package/dist/string/formatNumber.js +14 -14
  85. package/dist/string/generatePassword.d.ts +9 -9
  86. package/dist/string/generatePassword.js +23 -23
  87. package/dist/string/generateUUID.d.ts +2 -2
  88. package/dist/string/generateUUID.js +36 -36
  89. package/dist/string/getTextBetweenCharByIndex.d.ts +1 -1
  90. package/dist/string/getTextBetweenCharByIndex.js +20 -20
  91. package/dist/string/index.d.ts +65 -65
  92. package/dist/string/index.js +161 -161
  93. package/dist/string/indexesOf.d.ts +1 -1
  94. package/dist/string/indexesOf.js +14 -14
  95. package/dist/string/makeDaySlug.d.ts +31 -31
  96. package/dist/string/makeDaySlug.js +22 -22
  97. package/dist/string/random.d.ts +18 -18
  98. package/dist/string/random.js +40 -40
  99. package/dist/string/trimNull.d.ts +2 -2
  100. package/dist/string/trimNull.js +20 -20
  101. package/dist/string/url.d.ts +22 -22
  102. package/dist/string/url.js +74 -74
  103. package/esm/Checker.d.ts +8 -8
  104. package/esm/Checker.js +27 -27
  105. package/esm/EventDispatcher.d.ts +13 -13
  106. package/esm/EventDispatcher.js +48 -48
  107. package/esm/FileUpload.d.ts +12 -12
  108. package/esm/FileUpload.js +61 -61
  109. package/esm/Slug.d.ts +9 -9
  110. package/esm/Slug.js +329 -329
  111. package/esm/Timer.d.ts +4 -4
  112. package/esm/Timer.js +6 -6
  113. package/esm/Validation.d.ts +5 -5
  114. package/esm/Validation.js +36 -36
  115. package/esm/array.d.ts +113 -113
  116. package/esm/array.js +275 -275
  117. package/esm/color.d.ts +25 -25
  118. package/esm/color.js +85 -85
  119. package/esm/console/enableConsole.d.ts +2 -2
  120. package/esm/console/enableConsole.js +6 -6
  121. package/esm/console/index.d.ts +11 -11
  122. package/esm/console/index.js +12 -12
  123. package/esm/console/log.d.ts +15 -15
  124. package/esm/console/log.js +32 -32
  125. package/esm/device/browser.d.ts +5 -5
  126. package/esm/device/browser.js +29 -29
  127. package/esm/device/camera.d.ts +7 -7
  128. package/esm/device/camera.js +167 -167
  129. package/esm/device/index.d.ts +5 -5
  130. package/esm/device/index.js +216 -216
  131. package/esm/device/os.d.ts +11 -11
  132. package/esm/device/os.js +27 -27
  133. package/esm/file/createDir.d.ts +5 -5
  134. package/esm/file/createDir.js +12 -12
  135. package/esm/file/fileMove.d.ts +4 -4
  136. package/esm/file/fileMove.js +28 -28
  137. package/esm/file/findFilesByExt.d.ts +13 -13
  138. package/esm/file/findFilesByExt.js +45 -45
  139. package/esm/file/getAllFiles.d.ts +1 -0
  140. package/esm/file/getAllFiles.js +21 -0
  141. package/esm/file/getAllFiles.js.map +1 -0
  142. package/esm/file/index.d.ts +9 -9
  143. package/esm/file/index.js +5 -5
  144. package/esm/gameboi/index.d.ts +10 -10
  145. package/esm/gameboi/index.js +61 -61
  146. package/esm/gameboi/index.js.map +1 -1
  147. package/esm/images/downloadByUrl.d.ts +1 -1
  148. package/esm/images/downloadByUrl.js +52 -52
  149. package/esm/images/index.d.ts +2 -2
  150. package/esm/images/index.js +3 -3
  151. package/esm/images/loadImage.d.ts +1 -1
  152. package/esm/images/loadImage.js +14 -14
  153. package/esm/images/resize.d.ts +2 -2
  154. package/esm/images/resize.js +30 -30
  155. package/esm/images/upload.d.ts +10 -10
  156. package/esm/images/upload.js +19 -19
  157. package/esm/index.d.ts +37 -37
  158. package/esm/index.js +37 -37
  159. package/esm/json.d.ts +8 -8
  160. package/esm/json.js +27 -27
  161. package/esm/math/diffDate.d.ts +5 -5
  162. package/esm/math/diffDate.js +9 -9
  163. package/esm/math/index.d.ts +30 -30
  164. package/esm/math/index.js +77 -77
  165. package/esm/math/positiveNumber.d.ts +2 -2
  166. package/esm/math/positiveNumber.js +12 -12
  167. package/esm/name/en.d.ts +5 -5
  168. package/esm/name/en.js +21 -21
  169. package/esm/name/index.d.ts +12 -12
  170. package/esm/name/index.js +5 -5
  171. package/esm/name/vi.d.ts +5 -5
  172. package/esm/name/vi.js +23 -23
  173. package/esm/object.d.ts +59 -59
  174. package/esm/object.js +69 -69
  175. package/esm/permission/index.d.ts +8 -8
  176. package/esm/permission/index.js +4 -4
  177. package/esm/permission/requestCamera.d.ts +5 -5
  178. package/esm/permission/requestCamera.js +38 -38
  179. package/esm/permission/requestDeviceOrientationControl.d.ts +2 -2
  180. package/esm/permission/requestDeviceOrientationControl.js +34 -34
  181. package/esm/response/index.d.ts +49 -49
  182. package/esm/response/index.js +45 -45
  183. package/esm/string/convertPathnameAndQuery.d.ts +4 -4
  184. package/esm/string/convertPathnameAndQuery.js +21 -21
  185. package/esm/string/formatNumber.d.ts +6 -6
  186. package/esm/string/formatNumber.js +10 -10
  187. package/esm/string/generatePassword.d.ts +9 -9
  188. package/esm/string/generatePassword.js +19 -19
  189. package/esm/string/generateUUID.d.ts +2 -2
  190. package/esm/string/generateUUID.js +32 -32
  191. package/esm/string/getTextBetweenCharByIndex.d.ts +1 -1
  192. package/esm/string/getTextBetweenCharByIndex.js +14 -14
  193. package/esm/string/index.d.ts +65 -65
  194. package/esm/string/index.js +150 -150
  195. package/esm/string/indexesOf.d.ts +1 -1
  196. package/esm/string/indexesOf.js +11 -11
  197. package/esm/string/makeDaySlug.d.ts +31 -31
  198. package/esm/string/makeDaySlug.js +15 -15
  199. package/esm/string/random.d.ts +18 -18
  200. package/esm/string/random.js +33 -33
  201. package/esm/string/trimNull.d.ts +2 -2
  202. package/esm/string/trimNull.js +13 -13
  203. package/esm/string/url.d.ts +22 -22
  204. package/esm/string/url.js +64 -64
  205. package/package.json +4 -4
@@ -1,217 +1,217 @@
1
- export const isIos = () => {
2
- const deviceInfo = checkOS();
3
- if (deviceInfo)
4
- return deviceInfo.os.toLowerCase() == "ios";
5
- console.log("Can't check OS");
6
- return null;
7
- };
8
- export const isAndroid = () => {
9
- const deviceInfo = checkOS();
10
- if (deviceInfo)
11
- return deviceInfo.os.toLowerCase() == "android";
12
- console.log("Can't check OS");
13
- return null;
14
- };
15
- export const isTablet = () => {
16
- if (typeof navigator == "undefined")
17
- return null;
18
- if (typeof window == "undefined")
19
- return null;
20
- return isMobile() && window.innerWidth > 599 && window.innerHeight > 599;
21
- };
22
- export const isMobile = () => {
23
- if (typeof navigator == "undefined")
24
- return null;
25
- if (navigator.userAgent.match(/Android/i) ||
26
- navigator.userAgent.match(/webOS/i) ||
27
- navigator.userAgent.match(/iPhone/i) ||
28
- navigator.userAgent.match(/iPad/i) ||
29
- navigator.userAgent.match(/iPod/i) ||
30
- navigator.userAgent.match(/BlackBerry/i) ||
31
- navigator.userAgent.match(/Windows Phone/i)) {
32
- return true;
33
- }
34
- else {
35
- return false;
36
- }
37
- };
38
- /**
39
- *
40
- * @returns {{
41
- * screen,
42
- * browser,
43
- * browserVersion,
44
- * browserMajorVersion,
45
- * mobile,
46
- * os,
47
- * osVersion,
48
- * cookies,
49
- * flashVersion,
50
- * }}
51
- */
52
- let deviceInfo;
53
- export const checkOS = () => {
54
- var _a;
55
- if (typeof window == "undefined")
56
- return {};
57
- if (typeof deviceInfo == "undefined") {
58
- var unknown = "-";
59
- // screen
60
- var screenSize = "";
61
- if (screen.width) {
62
- var width = screen.width ? screen.width : "";
63
- var height = screen.height ? screen.height : "";
64
- screenSize += "" + width + " x " + height;
65
- }
66
- // browser
67
- var nVer = navigator.appVersion;
68
- var nAgt = navigator.userAgent;
69
- var browser = navigator.appName;
70
- var version = "" + parseFloat(navigator.appVersion);
71
- var majorVersion = parseInt(navigator.appVersion, 10);
72
- var nameOffset, verOffset, ix;
73
- // Opera
74
- if ((verOffset = nAgt.indexOf("Opera")) != -1) {
75
- browser = "Opera";
76
- version = nAgt.substring(verOffset + 6);
77
- if ((verOffset = nAgt.indexOf("Version")) != -1) {
78
- version = nAgt.substring(verOffset + 8);
79
- }
80
- }
81
- // Opera Next
82
- if ((verOffset = nAgt.indexOf("OPR")) != -1) {
83
- browser = "Opera";
84
- version = nAgt.substring(verOffset + 4);
85
- }
86
- // Edge
87
- else if ((verOffset = nAgt.indexOf("Edge")) != -1) {
88
- browser = "Microsoft Edge";
89
- version = nAgt.substring(verOffset + 5);
90
- }
91
- // MSIE
92
- else if ((verOffset = nAgt.indexOf("MSIE")) != -1) {
93
- browser = "Microsoft Internet Explorer";
94
- version = nAgt.substring(verOffset + 5);
95
- }
96
- // Chrome
97
- else if ((verOffset = nAgt.indexOf("Chrome")) != -1) {
98
- browser = "Chrome";
99
- version = nAgt.substring(verOffset + 7);
100
- }
101
- // Safari
102
- else if ((verOffset = nAgt.indexOf("Safari")) != -1) {
103
- browser = "Safari";
104
- version = nAgt.substring(verOffset + 7);
105
- if ((verOffset = nAgt.indexOf("Version")) != -1) {
106
- version = nAgt.substring(verOffset + 8);
107
- }
108
- }
109
- // Firefox
110
- else if ((verOffset = nAgt.indexOf("Firefox")) != -1) {
111
- browser = "Firefox";
112
- version = nAgt.substring(verOffset + 8);
113
- }
114
- // MSIE 11+
115
- else if (nAgt.indexOf("Trident/") != -1) {
116
- browser = "Microsoft Internet Explorer";
117
- version = nAgt.substring(nAgt.indexOf("rv:") + 3);
118
- }
119
- // Other browsers
120
- else if ((nameOffset = nAgt.lastIndexOf(" ") + 1) < (verOffset = nAgt.lastIndexOf("/"))) {
121
- browser = nAgt.substring(nameOffset, verOffset);
122
- version = nAgt.substring(verOffset + 1);
123
- if (browser.toLowerCase() == browser.toUpperCase()) {
124
- browser = navigator.appName;
125
- }
126
- }
127
- // trim the version string
128
- if ((ix = version.indexOf(";")) != -1)
129
- version = version.substring(0, ix);
130
- if ((ix = version.indexOf(" ")) != -1)
131
- version = version.substring(0, ix);
132
- if ((ix = version.indexOf(")")) != -1)
133
- version = version.substring(0, ix);
134
- majorVersion = parseInt("" + version, 10);
135
- if (isNaN(majorVersion)) {
136
- version = "" + parseFloat(navigator.appVersion);
137
- majorVersion = parseInt(navigator.appVersion, 10);
138
- }
139
- // mobile version
140
- var mobile = /Mobile|mini|Fennec|Android|iP(ad|od|hone)/.test(nVer);
141
- // cookie
142
- var cookieEnabled = navigator.cookieEnabled ? true : false;
143
- if (typeof navigator.cookieEnabled == "undefined" && !cookieEnabled) {
144
- document.cookie = "testcookie";
145
- cookieEnabled = document.cookie.indexOf("testcookie") != -1 ? true : false;
146
- }
147
- // system
148
- var os = unknown;
149
- var clientStrings = [
150
- { s: "Windows 10", r: /(Windows 10.0|Windows NT 10.0)/ },
151
- { s: "Windows 8.1", r: /(Windows 8.1|Windows NT 6.3)/ },
152
- { s: "Windows 8", r: /(Windows 8|Windows NT 6.2)/ },
153
- { s: "Windows 7", r: /(Windows 7|Windows NT 6.1)/ },
154
- { s: "Windows Vista", r: /Windows NT 6.0/ },
155
- { s: "Windows Server 2003", r: /Windows NT 5.2/ },
156
- { s: "Windows XP", r: /(Windows NT 5.1|Windows XP)/ },
157
- { s: "Windows 2000", r: /(Windows NT 5.0|Windows 2000)/ },
158
- { s: "Windows ME", r: /(Win 9x 4.90|Windows ME)/ },
159
- { s: "Windows 98", r: /(Windows 98|Win98)/ },
160
- { s: "Windows 95", r: /(Windows 95|Win95|Windows_95)/ },
161
- { s: "Windows NT 4.0", r: /(Windows NT 4.0|WinNT4.0|WinNT|Windows NT)/ },
162
- { s: "Windows CE", r: /Windows CE/ },
163
- { s: "Windows 3.11", r: /Win16/ },
164
- { s: "Android", r: /Android/ },
165
- { s: "Open BSD", r: /OpenBSD/ },
166
- { s: "Sun OS", r: /SunOS/ },
167
- { s: "Linux", r: /(Linux|X11)/ },
168
- { s: "iOS", r: /(iPhone|iPad|iPod)/ },
169
- { s: "Mac OS X", r: /Mac OS X/ },
170
- { s: "Mac OS", r: /(MacPPC|MacIntel|Mac_PowerPC|Macintosh)/ },
171
- { s: "QNX", r: /QNX/ },
172
- { s: "UNIX", r: /UNIX/ },
173
- { s: "BeOS", r: /BeOS/ },
174
- { s: "OS/2", r: /OS\/2/ },
175
- { s: "Search Bot", r: /(nuhk|Googlebot|Yammybot|Openbot|Slurp|MSNBot|Ask Jeeves\/Teoma|ia_archiver)/ },
176
- ];
177
- for (var id in clientStrings) {
178
- var cs = clientStrings[id];
179
- if (cs.r.test(nAgt)) {
180
- os = cs.s;
181
- break;
182
- }
183
- }
184
- var osVersion = unknown;
185
- if (/Windows/.test(os)) {
186
- const _osv = /Windows (.*)/.exec(os) || [];
187
- osVersion = _osv[1] || "unknown";
188
- os = "Windows";
189
- }
190
- switch (os) {
191
- case "Mac OS X":
192
- const _osvx = /Mac OS X (10[\.\_\d]+)/.exec(nAgt);
193
- osVersion = (_osvx === null || _osvx === void 0 ? void 0 : _osvx[1]) || "unknown";
194
- break;
195
- case "Android":
196
- osVersion = ((_a = /Android ([\.\_\d]+)/.exec(nAgt)) === null || _a === void 0 ? void 0 : _a[1]) || "unknown";
197
- break;
198
- case "iOS":
199
- const _osVersion = /OS (\d+)_(\d+)_?(\d+)?/.exec(nVer) || [0, 0, 0];
200
- osVersion = (_osVersion[1] || 0) + "." + (_osVersion[2] || 0) + "." + (_osVersion[3] || 0);
201
- break;
202
- }
203
- const _deviceInfo = {
204
- screen: screenSize,
205
- browser: browser,
206
- browserVersion: version,
207
- browserMajorVersion: majorVersion,
208
- mobile: mobile,
209
- os: os,
210
- osVersion: osVersion,
211
- cookies: cookieEnabled,
212
- };
213
- deviceInfo = _deviceInfo;
214
- }
215
- return deviceInfo;
216
- };
1
+ export const isIos = () => {
2
+ const deviceInfo = checkOS();
3
+ if (deviceInfo)
4
+ return deviceInfo.os.toLowerCase() == "ios";
5
+ console.log("Can't check OS");
6
+ return null;
7
+ };
8
+ export const isAndroid = () => {
9
+ const deviceInfo = checkOS();
10
+ if (deviceInfo)
11
+ return deviceInfo.os.toLowerCase() == "android";
12
+ console.log("Can't check OS");
13
+ return null;
14
+ };
15
+ export const isTablet = () => {
16
+ if (typeof navigator == "undefined")
17
+ return null;
18
+ if (typeof window == "undefined")
19
+ return null;
20
+ return isMobile() && window.innerWidth > 599 && window.innerHeight > 599;
21
+ };
22
+ export const isMobile = () => {
23
+ if (typeof navigator == "undefined")
24
+ return null;
25
+ if (navigator.userAgent.match(/Android/i) ||
26
+ navigator.userAgent.match(/webOS/i) ||
27
+ navigator.userAgent.match(/iPhone/i) ||
28
+ navigator.userAgent.match(/iPad/i) ||
29
+ navigator.userAgent.match(/iPod/i) ||
30
+ navigator.userAgent.match(/BlackBerry/i) ||
31
+ navigator.userAgent.match(/Windows Phone/i)) {
32
+ return true;
33
+ }
34
+ else {
35
+ return false;
36
+ }
37
+ };
38
+ /**
39
+ *
40
+ * @returns {{
41
+ * screen,
42
+ * browser,
43
+ * browserVersion,
44
+ * browserMajorVersion,
45
+ * mobile,
46
+ * os,
47
+ * osVersion,
48
+ * cookies,
49
+ * flashVersion,
50
+ * }}
51
+ */
52
+ let deviceInfo;
53
+ export const checkOS = () => {
54
+ var _a;
55
+ if (typeof window == "undefined")
56
+ return {};
57
+ if (typeof deviceInfo == "undefined") {
58
+ var unknown = "-";
59
+ // screen
60
+ var screenSize = "";
61
+ if (screen.width) {
62
+ var width = screen.width ? screen.width : "";
63
+ var height = screen.height ? screen.height : "";
64
+ screenSize += "" + width + " x " + height;
65
+ }
66
+ // browser
67
+ var nVer = navigator.appVersion;
68
+ var nAgt = navigator.userAgent;
69
+ var browser = navigator.appName;
70
+ var version = "" + parseFloat(navigator.appVersion);
71
+ var majorVersion = parseInt(navigator.appVersion, 10);
72
+ var nameOffset, verOffset, ix;
73
+ // Opera
74
+ if ((verOffset = nAgt.indexOf("Opera")) != -1) {
75
+ browser = "Opera";
76
+ version = nAgt.substring(verOffset + 6);
77
+ if ((verOffset = nAgt.indexOf("Version")) != -1) {
78
+ version = nAgt.substring(verOffset + 8);
79
+ }
80
+ }
81
+ // Opera Next
82
+ if ((verOffset = nAgt.indexOf("OPR")) != -1) {
83
+ browser = "Opera";
84
+ version = nAgt.substring(verOffset + 4);
85
+ }
86
+ // Edge
87
+ else if ((verOffset = nAgt.indexOf("Edge")) != -1) {
88
+ browser = "Microsoft Edge";
89
+ version = nAgt.substring(verOffset + 5);
90
+ }
91
+ // MSIE
92
+ else if ((verOffset = nAgt.indexOf("MSIE")) != -1) {
93
+ browser = "Microsoft Internet Explorer";
94
+ version = nAgt.substring(verOffset + 5);
95
+ }
96
+ // Chrome
97
+ else if ((verOffset = nAgt.indexOf("Chrome")) != -1) {
98
+ browser = "Chrome";
99
+ version = nAgt.substring(verOffset + 7);
100
+ }
101
+ // Safari
102
+ else if ((verOffset = nAgt.indexOf("Safari")) != -1) {
103
+ browser = "Safari";
104
+ version = nAgt.substring(verOffset + 7);
105
+ if ((verOffset = nAgt.indexOf("Version")) != -1) {
106
+ version = nAgt.substring(verOffset + 8);
107
+ }
108
+ }
109
+ // Firefox
110
+ else if ((verOffset = nAgt.indexOf("Firefox")) != -1) {
111
+ browser = "Firefox";
112
+ version = nAgt.substring(verOffset + 8);
113
+ }
114
+ // MSIE 11+
115
+ else if (nAgt.indexOf("Trident/") != -1) {
116
+ browser = "Microsoft Internet Explorer";
117
+ version = nAgt.substring(nAgt.indexOf("rv:") + 3);
118
+ }
119
+ // Other browsers
120
+ else if ((nameOffset = nAgt.lastIndexOf(" ") + 1) < (verOffset = nAgt.lastIndexOf("/"))) {
121
+ browser = nAgt.substring(nameOffset, verOffset);
122
+ version = nAgt.substring(verOffset + 1);
123
+ if (browser.toLowerCase() == browser.toUpperCase()) {
124
+ browser = navigator.appName;
125
+ }
126
+ }
127
+ // trim the version string
128
+ if ((ix = version.indexOf(";")) != -1)
129
+ version = version.substring(0, ix);
130
+ if ((ix = version.indexOf(" ")) != -1)
131
+ version = version.substring(0, ix);
132
+ if ((ix = version.indexOf(")")) != -1)
133
+ version = version.substring(0, ix);
134
+ majorVersion = parseInt("" + version, 10);
135
+ if (isNaN(majorVersion)) {
136
+ version = "" + parseFloat(navigator.appVersion);
137
+ majorVersion = parseInt(navigator.appVersion, 10);
138
+ }
139
+ // mobile version
140
+ var mobile = /Mobile|mini|Fennec|Android|iP(ad|od|hone)/.test(nVer);
141
+ // cookie
142
+ var cookieEnabled = navigator.cookieEnabled ? true : false;
143
+ if (typeof navigator.cookieEnabled == "undefined" && !cookieEnabled) {
144
+ document.cookie = "testcookie";
145
+ cookieEnabled = document.cookie.indexOf("testcookie") != -1 ? true : false;
146
+ }
147
+ // system
148
+ var os = unknown;
149
+ var clientStrings = [
150
+ { s: "Windows 10", r: /(Windows 10.0|Windows NT 10.0)/ },
151
+ { s: "Windows 8.1", r: /(Windows 8.1|Windows NT 6.3)/ },
152
+ { s: "Windows 8", r: /(Windows 8|Windows NT 6.2)/ },
153
+ { s: "Windows 7", r: /(Windows 7|Windows NT 6.1)/ },
154
+ { s: "Windows Vista", r: /Windows NT 6.0/ },
155
+ { s: "Windows Server 2003", r: /Windows NT 5.2/ },
156
+ { s: "Windows XP", r: /(Windows NT 5.1|Windows XP)/ },
157
+ { s: "Windows 2000", r: /(Windows NT 5.0|Windows 2000)/ },
158
+ { s: "Windows ME", r: /(Win 9x 4.90|Windows ME)/ },
159
+ { s: "Windows 98", r: /(Windows 98|Win98)/ },
160
+ { s: "Windows 95", r: /(Windows 95|Win95|Windows_95)/ },
161
+ { s: "Windows NT 4.0", r: /(Windows NT 4.0|WinNT4.0|WinNT|Windows NT)/ },
162
+ { s: "Windows CE", r: /Windows CE/ },
163
+ { s: "Windows 3.11", r: /Win16/ },
164
+ { s: "Android", r: /Android/ },
165
+ { s: "Open BSD", r: /OpenBSD/ },
166
+ { s: "Sun OS", r: /SunOS/ },
167
+ { s: "Linux", r: /(Linux|X11)/ },
168
+ { s: "iOS", r: /(iPhone|iPad|iPod)/ },
169
+ { s: "Mac OS X", r: /Mac OS X/ },
170
+ { s: "Mac OS", r: /(MacPPC|MacIntel|Mac_PowerPC|Macintosh)/ },
171
+ { s: "QNX", r: /QNX/ },
172
+ { s: "UNIX", r: /UNIX/ },
173
+ { s: "BeOS", r: /BeOS/ },
174
+ { s: "OS/2", r: /OS\/2/ },
175
+ { s: "Search Bot", r: /(nuhk|Googlebot|Yammybot|Openbot|Slurp|MSNBot|Ask Jeeves\/Teoma|ia_archiver)/ },
176
+ ];
177
+ for (var id in clientStrings) {
178
+ var cs = clientStrings[id];
179
+ if (cs.r.test(nAgt)) {
180
+ os = cs.s;
181
+ break;
182
+ }
183
+ }
184
+ var osVersion = unknown;
185
+ if (/Windows/.test(os)) {
186
+ const _osv = /Windows (.*)/.exec(os) || [];
187
+ osVersion = _osv[1] || "unknown";
188
+ os = "Windows";
189
+ }
190
+ switch (os) {
191
+ case "Mac OS X":
192
+ const _osvx = /Mac OS X (10[\.\_\d]+)/.exec(nAgt);
193
+ osVersion = (_osvx === null || _osvx === void 0 ? void 0 : _osvx[1]) || "unknown";
194
+ break;
195
+ case "Android":
196
+ osVersion = ((_a = /Android ([\.\_\d]+)/.exec(nAgt)) === null || _a === void 0 ? void 0 : _a[1]) || "unknown";
197
+ break;
198
+ case "iOS":
199
+ const _osVersion = /OS (\d+)_(\d+)_?(\d+)?/.exec(nVer) || [0, 0, 0];
200
+ osVersion = (_osVersion[1] || 0) + "." + (_osVersion[2] || 0) + "." + (_osVersion[3] || 0);
201
+ break;
202
+ }
203
+ const _deviceInfo = {
204
+ screen: screenSize,
205
+ browser: browser,
206
+ browserVersion: version,
207
+ browserMajorVersion: majorVersion,
208
+ mobile: mobile,
209
+ os: os,
210
+ osVersion: osVersion,
211
+ cookies: cookieEnabled,
212
+ };
213
+ deviceInfo = _deviceInfo;
214
+ }
215
+ return deviceInfo;
216
+ };
217
217
  //# sourceMappingURL=index.js.map
@@ -1,11 +1,11 @@
1
- export declare function getOS(): "android" | "win" | "aix" | "freebsd" | "haiku" | "linux" | "openbsd" | "sunos" | "cygwin" | "netbsd" | "mac";
2
- export declare function isWin(): boolean;
3
- export declare function isMac(): boolean;
4
- export declare function isLinux(): boolean;
5
- declare const _default: {
6
- getOS: typeof getOS;
7
- isWin: typeof isWin;
8
- isMac: typeof isMac;
9
- isLinux: typeof isLinux;
10
- };
11
- export default _default;
1
+ export declare function getOS(): "android" | "win" | "aix" | "freebsd" | "haiku" | "linux" | "openbsd" | "sunos" | "cygwin" | "netbsd" | "mac";
2
+ export declare function isWin(): boolean;
3
+ export declare function isMac(): boolean;
4
+ export declare function isLinux(): boolean;
5
+ declare const _default: {
6
+ getOS: typeof getOS;
7
+ isWin: typeof isWin;
8
+ isMac: typeof isMac;
9
+ isLinux: typeof isLinux;
10
+ };
11
+ export default _default;
package/esm/device/os.js CHANGED
@@ -1,28 +1,28 @@
1
- // var osvar = process.platform;
2
- import os from "os";
3
- export function getOS() {
4
- const osvar = os.platform();
5
- if (osvar == "darwin") {
6
- return "mac";
7
- }
8
- else if (osvar == "win32") {
9
- return "win";
10
- }
11
- else if (osvar == "linux") {
12
- return "linux";
13
- }
14
- else {
15
- return osvar;
16
- }
17
- }
18
- export function isWin() {
19
- return os.platform() == "win32";
20
- }
21
- export function isMac() {
22
- return os.platform() == "darwin";
23
- }
24
- export function isLinux() {
25
- return os.platform() == "linux";
26
- }
27
- export default { getOS, isWin, isMac, isLinux };
1
+ // var osvar = process.platform;
2
+ import os from "os";
3
+ export function getOS() {
4
+ const osvar = os.platform();
5
+ if (osvar == "darwin") {
6
+ return "mac";
7
+ }
8
+ else if (osvar == "win32") {
9
+ return "win";
10
+ }
11
+ else if (osvar == "linux") {
12
+ return "linux";
13
+ }
14
+ else {
15
+ return osvar;
16
+ }
17
+ }
18
+ export function isWin() {
19
+ return os.platform() == "win32";
20
+ }
21
+ export function isMac() {
22
+ return os.platform() == "darwin";
23
+ }
24
+ export function isLinux() {
25
+ return os.platform() == "linux";
26
+ }
27
+ export default { getOS, isWin, isMac, isLinux };
28
28
  //# sourceMappingURL=os.js.map
@@ -1,5 +1,5 @@
1
- /**
2
- * Create new directory
3
- */
4
- declare function createDir(path: string): true | undefined;
5
- export { createDir };
1
+ /**
2
+ * Create new directory
3
+ */
4
+ declare function createDir(path: string): true | undefined;
5
+ export { createDir };
@@ -1,13 +1,13 @@
1
- const fs = require("fs");
2
- /**
3
- * Create new directory
4
- */
5
- function createDir(path) {
6
- if (fs.existsSync(path)) {
7
- console.log("directory already exited !");
8
- return true;
9
- }
10
- fs.mkdirSync(path, { recursive: true });
11
- }
12
- export { createDir };
1
+ const fs = require("fs");
2
+ /**
3
+ * Create new directory
4
+ */
5
+ function createDir(path) {
6
+ if (fs.existsSync(path)) {
7
+ console.log("directory already exited !");
8
+ return true;
9
+ }
10
+ fs.mkdirSync(path, { recursive: true });
11
+ }
12
+ export { createDir };
13
13
  //# sourceMappingURL=createDir.js.map
@@ -1,4 +1,4 @@
1
- /**
2
- * Move file to another location.
3
- */
4
- export declare function fileMove(oldPath: string, newPath: string, callback: any): void;
1
+ /**
2
+ * Move file to another location.
3
+ */
4
+ export declare function fileMove(oldPath: string, newPath: string, callback: any): void;
@@ -1,29 +1,29 @@
1
- const fs = require("fs");
2
- /**
3
- * Move file to another location.
4
- */
5
- export function fileMove(oldPath, newPath, callback) {
6
- fs.rename(oldPath, newPath, function (err) {
7
- if (err) {
8
- if (err.code === "EXDEV") {
9
- copy();
10
- }
11
- else {
12
- callback(err);
13
- }
14
- return;
15
- }
16
- callback();
17
- });
18
- function copy() {
19
- var readStream = fs.createReadStream(oldPath);
20
- var writeStream = fs.createWriteStream(newPath);
21
- readStream.on("error", callback);
22
- writeStream.on("error", callback);
23
- readStream.on("close", function () {
24
- fs.unlink(oldPath, callback);
25
- });
26
- readStream.pipe(writeStream);
27
- }
28
- }
1
+ const fs = require("fs");
2
+ /**
3
+ * Move file to another location.
4
+ */
5
+ export function fileMove(oldPath, newPath, callback) {
6
+ fs.rename(oldPath, newPath, function (err) {
7
+ if (err) {
8
+ if (err.code === "EXDEV") {
9
+ copy();
10
+ }
11
+ else {
12
+ callback(err);
13
+ }
14
+ return;
15
+ }
16
+ callback();
17
+ });
18
+ function copy() {
19
+ var readStream = fs.createReadStream(oldPath);
20
+ var writeStream = fs.createWriteStream(newPath);
21
+ readStream.on("error", callback);
22
+ writeStream.on("error", callback);
23
+ readStream.on("close", function () {
24
+ fs.unlink(oldPath, callback);
25
+ });
26
+ readStream.pipe(writeStream);
27
+ }
28
+ }
29
29
  //# sourceMappingURL=fileMove.js.map
@@ -1,13 +1,13 @@
1
- /**
2
- * This is an alias of "findFileByExt()"
3
- */
4
- export declare const forEachFileByExt: (base: string, ext: string, cb: (path: string) => {}) => void;
5
- /**
6
- * This is an alias of "forEachFileByExt()"
7
- */
8
- export declare const findFileByExt: (base: string, ext: string, cb: (path: string) => {}) => void;
9
- declare const fileExt: {
10
- findFileByExt: (base: string, ext: string, cb: (path: string) => {}) => void;
11
- forEachFileByExt: (base: string, ext: string, cb: (path: string) => {}) => void;
12
- };
13
- export default fileExt;
1
+ /**
2
+ * This is an alias of "findFileByExt()"
3
+ */
4
+ export declare const forEachFileByExt: (base: string, ext: string, cb: (path: string) => {}) => void;
5
+ /**
6
+ * This is an alias of "forEachFileByExt()"
7
+ */
8
+ export declare const findFileByExt: (base: string, ext: string, cb: (path: string) => {}) => void;
9
+ declare const fileExt: {
10
+ findFileByExt: (base: string, ext: string, cb: (path: string) => {}) => void;
11
+ forEachFileByExt: (base: string, ext: string, cb: (path: string) => {}) => void;
12
+ };
13
+ export default fileExt;