umaki 0.3.1 → 0.3.2

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 (101) hide show
  1. package/README.md +207 -198
  2. package/dist/_virtual/_commonjsHelpers.cjs.js +1 -1
  3. package/dist/_virtual/_commonjsHelpers.es.js +1 -1
  4. package/dist/_virtual/isBetween.cjs.js +1 -1
  5. package/dist/_virtual/isBetween.es.js +1 -1
  6. package/dist/index.cjs.js +1 -1
  7. package/dist/index.es.js +1 -1
  8. package/dist/libs/control/bgScrollStop.cjs.js +1 -1
  9. package/dist/libs/control/bgScrollStop.es.js +1 -1
  10. package/dist/libs/control/pd.cjs.js +1 -1
  11. package/dist/libs/control/pd.es.js +1 -1
  12. package/dist/libs/control/scrollToHash.cjs.js +1 -1
  13. package/dist/libs/control/scrollToHash.es.js +1 -1
  14. package/dist/libs/control/videoPlayControl.cjs.js +1 -1
  15. package/dist/libs/control/videoPlayControl.es.js +1 -1
  16. package/dist/libs/convert/changeDateStringToSpecificFormat.cjs.js +1 -1
  17. package/dist/libs/convert/changeDateStringToSpecificFormat.es.js +1 -1
  18. package/dist/libs/convert/jsonStringToJsonObject.cjs.js +1 -1
  19. package/dist/libs/convert/jsonStringToJsonObject.es.js +1 -1
  20. package/dist/libs/eventControl/debounce.cjs.js +1 -1
  21. package/dist/libs/eventControl/debounce.es.js +1 -1
  22. package/dist/libs/eventControl/throttle.cjs.js +1 -1
  23. package/dist/libs/eventControl/throttle.es.js +1 -1
  24. package/dist/libs/get/getAspectRatio.cjs.js +1 -1
  25. package/dist/libs/get/getAspectRatio.es.js +1 -1
  26. package/dist/libs/get/getClassNames.cjs.js +1 -1
  27. package/dist/libs/get/getClassNames.es.js +1 -1
  28. package/dist/libs/get/getDocumentHeight.cjs.js +1 -1
  29. package/dist/libs/get/getDocumentHeight.es.js +1 -1
  30. package/dist/libs/get/getEventPaths.cjs.js +1 -1
  31. package/dist/libs/get/getEventPaths.es.js +1 -1
  32. package/dist/libs/get/getGcd.cjs.js +1 -1
  33. package/dist/libs/get/getGcd.es.js +1 -1
  34. package/dist/libs/get/getOrientation.cjs.js +1 -1
  35. package/dist/libs/get/getOrientation.es.js +1 -1
  36. package/dist/libs/get/getParentList.cjs.js +1 -1
  37. package/dist/libs/get/getParentList.es.js +1 -1
  38. package/dist/libs/get/getQueryParams.cjs.js +5 -4
  39. package/dist/libs/get/getQueryParams.d.ts +6 -2
  40. package/dist/libs/get/getQueryParams.es.js +5 -4
  41. package/dist/libs/get/getRem.cjs.js +1 -1
  42. package/dist/libs/get/getRem.es.js +1 -1
  43. package/dist/libs/get/getScrollbarWidth.cjs.js +1 -1
  44. package/dist/libs/get/getScrollbarWidth.es.js +1 -1
  45. package/dist/libs/get/getSessionStorage.cjs.js +1 -1
  46. package/dist/libs/get/getSessionStorage.es.js +1 -1
  47. package/dist/libs/get/getStringLength.cjs.js +1 -1
  48. package/dist/libs/get/getStringLength.es.js +1 -1
  49. package/dist/libs/get/getStylePropertyValue.cjs.js +1 -1
  50. package/dist/libs/get/getStylePropertyValue.es.js +1 -1
  51. package/dist/libs/get/getStylePropertyValueToNumber.cjs.js +1 -1
  52. package/dist/libs/get/getStylePropertyValueToNumber.es.js +1 -1
  53. package/dist/libs/get/getUaData.cjs.js +1 -1
  54. package/dist/libs/get/getUaData.es.js +1 -1
  55. package/dist/libs/is/isBetweenDateTime.cjs.js +1 -1
  56. package/dist/libs/is/isBetweenDateTime.es.js +1 -1
  57. package/dist/libs/is/isExistAllElements.cjs.js +1 -1
  58. package/dist/libs/is/isExistAllElements.es.js +1 -1
  59. package/dist/libs/is/isIpad.cjs.js +1 -1
  60. package/dist/libs/is/isIpad.es.js +1 -1
  61. package/dist/libs/is/isKeyExists.cjs.js +1 -1
  62. package/dist/libs/is/isKeyExists.es.js +1 -1
  63. package/dist/libs/is/isSafari.cjs.js +1 -1
  64. package/dist/libs/is/isSafari.es.js +1 -1
  65. package/dist/libs/is/isScrollable.cjs.js +1 -1
  66. package/dist/libs/is/isScrollable.es.js +1 -1
  67. package/dist/libs/is/isTouchSupport.cjs.js +1 -1
  68. package/dist/libs/is/isTouchSupport.es.js +1 -1
  69. package/dist/libs/remove/removeAllHtmlTags.cjs.js +1 -1
  70. package/dist/libs/remove/removeAllHtmlTags.es.js +1 -1
  71. package/dist/libs/remove/removeAttribute.cjs.js +1 -1
  72. package/dist/libs/remove/removeAttribute.es.js +1 -1
  73. package/dist/libs/remove/removeSessionStorage.cjs.js +1 -1
  74. package/dist/libs/remove/removeSessionStorage.es.js +1 -1
  75. package/dist/libs/remove/removeStylePropertyValue.cjs.js +1 -1
  76. package/dist/libs/remove/removeStylePropertyValue.es.js +1 -1
  77. package/dist/libs/set/set100vh.cjs.js +1 -1
  78. package/dist/libs/set/set100vh.es.js +1 -1
  79. package/dist/libs/set/set100vw.cjs.js +1 -1
  80. package/dist/libs/set/set100vw.es.js +1 -1
  81. package/dist/libs/set/setAttribute.cjs.js +1 -1
  82. package/dist/libs/set/setAttribute.es.js +1 -1
  83. package/dist/libs/set/setScrollPositionToCenter.cjs.js +1 -1
  84. package/dist/libs/set/setScrollPositionToCenter.es.js +1 -1
  85. package/dist/libs/set/setSessionStorage.cjs.js +1 -1
  86. package/dist/libs/set/setSessionStorage.es.js +1 -1
  87. package/dist/libs/set/setStylePropertyValue.cjs.js +1 -1
  88. package/dist/libs/set/setStylePropertyValue.es.js +1 -1
  89. package/dist/libs/to/toBoolean.cjs.js +1 -1
  90. package/dist/libs/to/toBoolean.es.js +1 -1
  91. package/dist/libs/to/toPositiveNumber.cjs.js +1 -1
  92. package/dist/libs/to/toPositiveNumber.es.js +1 -1
  93. package/dist/libs/transform/wrapTextWithSpans.cjs.js +1 -1
  94. package/dist/libs/transform/wrapTextWithSpans.es.js +1 -1
  95. package/dist/libs/wait/sleep.cjs.js +1 -1
  96. package/dist/libs/wait/sleep.es.js +1 -1
  97. package/dist/libs/wait/waitForAllMediaLoaded.cjs.js +1 -1
  98. package/dist/libs/wait/waitForAllMediaLoaded.es.js +1 -1
  99. package/dist/node_modules/dayjs/plugin/isBetween.cjs.js +1 -1
  100. package/dist/node_modules/dayjs/plugin/isBetween.es.js +1 -1
  101. package/package.json +1 -1
package/README.md CHANGED
@@ -12,8 +12,8 @@ A package that allows you to import frequently used utilities for web developmen
12
12
 
13
13
  ## Usage
14
14
 
15
- ``` ts
16
- import { foo } from 'umaki'
15
+ ```ts
16
+ import { foo } from "umaki";
17
17
  ```
18
18
 
19
19
  ## List of Utilities
@@ -80,11 +80,11 @@ import { foo } from 'umaki'
80
80
 
81
81
  A function that stops scrolling.
82
82
 
83
- ``` ts
84
- import { bgScrollStop } from 'umaki'
83
+ ```ts
84
+ import { bgScrollStop } from "umaki";
85
85
 
86
- bgScrollStop() // scroll stop
87
- bgScrollStop(false) // scroll start
86
+ bgScrollStop(); // scroll stop
87
+ bgScrollStop(false); // scroll start
88
88
  ```
89
89
 
90
90
  [View file →](src/libs/control/bgScrollStop.ts)
@@ -93,10 +93,10 @@ bgScrollStop(false) // scroll start
93
93
 
94
94
  A function that prevents the default event behavior.
95
95
 
96
- ``` ts
97
- import { pd } from 'umaki'
96
+ ```ts
97
+ import { pd } from "umaki";
98
98
 
99
- document.getElementById('myElement').addEventListener('click', pd)
99
+ document.getElementById("myElement").addEventListener("click", pd);
100
100
  ```
101
101
 
102
102
  [View file →](src/libs/control/pd.ts)
@@ -105,19 +105,18 @@ document.getElementById('myElement').addEventListener('click', pd)
105
105
 
106
106
  A function that scrolls to a specific hash position.
107
107
 
108
- ``` ts
109
- import { scrollToHash } from 'umaki'
110
-
111
- ;(async () => {
112
- await scrollToHash('#target')
113
- console.log('Scrolled!')
108
+ ```ts
109
+ import { scrollToHash } from "umaki";
110
+ (async () => {
111
+ await scrollToHash("#target");
112
+ console.log("Scrolled!");
114
113
 
115
114
  // smooth scroll
116
- await scrollToHash('#target', true)
115
+ await scrollToHash("#target", true);
117
116
 
118
117
  // smooth scroll + offset
119
- await scrollToHash('#target', true, 100)
120
- })()
118
+ await scrollToHash("#target", true, 100);
119
+ })();
121
120
  ```
122
121
 
123
122
  [View file →](src/libs/control/scrollToHash.ts)
@@ -126,15 +125,15 @@ import { scrollToHash } from 'umaki'
126
125
 
127
126
  A function that controls the playback of a video element.
128
127
 
129
- ``` ts
130
- import { videoPlayControl } from 'umaki'
128
+ ```ts
129
+ import { videoPlayControl } from "umaki";
131
130
 
132
- const videoElement = document.getElementById('myVideo')
133
- videoPlayControl(videoElement, true) // play
134
- videoPlayControl(videoElement, false) // pause
131
+ const videoElement = document.getElementById("myVideo");
132
+ videoPlayControl(videoElement, true); // play
133
+ videoPlayControl(videoElement, false); // pause
135
134
 
136
135
  // set currentTime
137
- videoPlayControl(videoElement, true, 10) // play and set currentTime to 10
136
+ videoPlayControl(videoElement, true, 10); // play and set currentTime to 10
138
137
  ```
139
138
 
140
139
  [View file →](src/libs/control/videoPlayControl.ts)
@@ -146,11 +145,11 @@ videoPlayControl(videoElement, true, 10) // play and set currentTime to 10
146
145
  A function that converts a date string to a specific format.
147
146
 
148
147
  ```ts
149
- import { changeDateStringToSpecificFormat } from 'umaki'
148
+ import { changeDateStringToSpecificFormat } from "umaki";
150
149
 
151
- const date = '2023-10-05'
152
- const formattedDate = changeDateStringToSpecificFormat(date, 'MM/DD/YYYY')
153
- console.log(formattedDate) // '10/05/2023'
150
+ const date = "2023-10-05";
151
+ const formattedDate = changeDateStringToSpecificFormat(date, "MM/DD/YYYY");
152
+ console.log(formattedDate); // '10/05/2023'
154
153
  ```
155
154
 
156
155
  [View file →](src/libs/convert/changeDateStringToSpecificFormat.ts)
@@ -160,11 +159,11 @@ console.log(formattedDate) // '10/05/2023'
160
159
  A function that converts a JSON string to a JSON object.
161
160
 
162
161
  ```ts
163
- import { jsonStringToJsonObject } from 'umaki'
162
+ import { jsonStringToJsonObject } from "umaki";
164
163
 
165
- const jsonString = '{"name": "John", "age": 30}'
166
- const jsonObject = jsonStringToJsonObject(jsonString)
167
- console.log(jsonObject) // { name: 'John', age: 30 }
164
+ const jsonString = '{"name": "John", "age": 30}';
165
+ const jsonObject = jsonStringToJsonObject(jsonString);
166
+ console.log(jsonObject); // { name: 'John', age: 30 }
168
167
  ```
169
168
 
170
169
  [View file →](src/libs/convert/jsonStringToJsonObject.ts)
@@ -176,13 +175,13 @@ console.log(jsonObject) // { name: 'John', age: 30 }
176
175
  A function that limits the number of times a function is called to at most one time over a specified time period.
177
176
 
178
177
  ```ts
179
- import { debounce } from 'umaki'
178
+ import { debounce } from "umaki";
180
179
 
181
180
  const debouncedFunction = debounce(() => {
182
- console.log('Debounced!')
183
- }, 300)
181
+ console.log("Debounced!");
182
+ }, 300);
184
183
 
185
- window.addEventListener('resize', debouncedFunction)
184
+ window.addEventListener("resize", debouncedFunction);
186
185
  ```
187
186
 
188
187
  [View file →](src/libs/eventControl/debounce.ts)
@@ -192,13 +191,13 @@ window.addEventListener('resize', debouncedFunction)
192
191
  A function that limits the number of times a function is called to a maximum of once in a specified period.
193
192
 
194
193
  ```ts
195
- import { throttle } from 'umaki'
194
+ import { throttle } from "umaki";
196
195
 
197
196
  const throttledFunction = throttle(() => {
198
- console.log('Throttled!')
199
- }, 300)
197
+ console.log("Throttled!");
198
+ }, 300);
200
199
 
201
- window.addEventListener('scroll', throttledFunction)
200
+ window.addEventListener("scroll", throttledFunction);
202
201
  ```
203
202
 
204
203
  [View file →](src/libs/eventControl/throttle.ts)
@@ -210,10 +209,10 @@ window.addEventListener('scroll', throttledFunction)
210
209
  A function that returns the aspect ratio of the specified width and height.
211
210
 
212
211
  ```ts
213
- import { getAspectRatio } from 'umaki'
212
+ import { getAspectRatio } from "umaki";
214
213
 
215
- const aspectRatio = getAspectRatio(1920, 1080)
216
- console.log(aspectRatio) // { w: 16, h: 9 }
214
+ const aspectRatio = getAspectRatio(1920, 1080);
215
+ console.log(aspectRatio); // { w: 16, h: 9 }
217
216
  ```
218
217
 
219
218
  [View file →](src/libs/get/getAspectRatio.ts)
@@ -223,12 +222,12 @@ console.log(aspectRatio) // { w: 16, h: 9 }
223
222
  A function that retrieves the class names of the specified HTML element as an array.
224
223
 
225
224
  ```ts
226
- import { getClassNames } from 'umaki'
225
+ import { getClassNames } from "umaki";
227
226
 
228
- const element = document.createElement('div')
229
- element.className = 'class1 class2 class3'
230
- const classNames = getClassNames(element)
231
- console.log(classNames) // ['class1', 'class2', 'class3']
227
+ const element = document.createElement("div");
228
+ element.className = "class1 class2 class3";
229
+ const classNames = getClassNames(element);
230
+ console.log(classNames); // ['class1', 'class2', 'class3']
232
231
  ```
233
232
 
234
233
  [View file →](src/libs/get/getClassNames.ts)
@@ -238,10 +237,10 @@ console.log(classNames) // ['class1', 'class2', 'class3']
238
237
  A function that retrieves the height of the document.
239
238
 
240
239
  ```ts
241
- import { getDocumentHeight } from 'umaki'
240
+ import { getDocumentHeight } from "umaki";
242
241
 
243
- const height = getDocumentHeight()
244
- console.log(height)
242
+ const height = getDocumentHeight();
243
+ console.log(height);
245
244
  ```
246
245
 
247
246
  [View file →](src/libs/get/getDocumentHeight.ts)
@@ -251,12 +250,12 @@ console.log(height)
251
250
  A function that retrieves the event paths.
252
251
 
253
252
  ```ts
254
- import { getEventPaths } from 'umaki'
253
+ import { getEventPaths } from "umaki";
255
254
 
256
- document.addEventListener('click', (event) => {
257
- const paths = getEventPaths(event)
258
- console.log(paths)
259
- })
255
+ document.addEventListener("click", (event) => {
256
+ const paths = getEventPaths(event);
257
+ console.log(paths);
258
+ });
260
259
  ```
261
260
 
262
261
  [View file →](src/libs/get/getEventPaths.ts)
@@ -266,10 +265,10 @@ document.addEventListener('click', (event) => {
266
265
  A function that calculates the greatest common divisor of two numbers.
267
266
 
268
267
  ```ts
269
- import { getGcd } from 'umaki'
268
+ import { getGcd } from "umaki";
270
269
 
271
- const gcd = getGcd(48, 18)
272
- console.log(gcd) // 6
270
+ const gcd = getGcd(48, 18);
271
+ console.log(gcd); // 6
273
272
  ```
274
273
 
275
274
  [View file →](src/libs/get/getGcd.ts)
@@ -279,10 +278,10 @@ console.log(gcd) // 6
279
278
  A function that retrieves the current orientation of the device.
280
279
 
281
280
  ```ts
282
- import { getOrientation } from 'umaki'
281
+ import { getOrientation } from "umaki";
283
282
 
284
- const orientation = getOrientation()
285
- console.log(orientation) // 'landscape' or 'portrait'
283
+ const orientation = getOrientation();
284
+ console.log(orientation); // 'landscape' or 'portrait'
286
285
  ```
287
286
 
288
287
  [View file →](src/libs/get/getOrientation.ts)
@@ -292,29 +291,38 @@ console.log(orientation) // 'landscape' or 'portrait'
292
291
  A function that recursively retrieves the parent elements of the specified HTML element.
293
292
 
294
293
  ```ts
295
- import { getParentList } from 'umaki'
294
+ import { getParentList } from "umaki";
296
295
 
297
- const element = document.createElement('div')
298
- const parentList = getParentList(element)
299
- console.log(parentList)
296
+ const element = document.createElement("div");
297
+ const parentList = getParentList(element);
298
+ console.log(parentList);
300
299
  ```
301
300
 
302
301
  [View file →](src/libs/get/getParentList.ts)
303
302
 
304
303
  ### getQueryParams
305
304
 
306
- A function that retrieves the query parameters from the URL.
307
- This is a wrapper around query-string, so you can specify [options](https://github.com/sindresorhus/query-string) in the second argument.
305
+ A function that retrieves the value of a specified query parameter from the URL.
308
306
 
309
307
  ```ts
310
- import { getQueryParams } from 'umaki'
308
+ import { getQueryParams } from "umaki";
311
309
 
312
- const params = getQueryParams('test') // https://example.com?test=123
313
- console.log(params) // 123
310
+ // Basic usage
311
+ const param = getQueryParams("id"); // returns value from window.location.search
314
312
 
315
- // Example of specifying options
316
- const params = getQueryParams('test', { parseNumbers: false })
317
- console.log(params) // '123'
313
+ // With custom search string
314
+ const customParam = getQueryParams("id", { searchString: "?id=123" });
315
+
316
+ // With parse options
317
+ const paramWithOptions = getQueryParams("id", {
318
+ parseOptions: { arrayFormat: "bracket" },
319
+ });
320
+
321
+ // With both custom search string and parse options
322
+ const customParamWithOptions = getQueryParams("id", {
323
+ searchString: "?id=123",
324
+ parseOptions: { arrayFormat: "bracket" },
325
+ });
318
326
  ```
319
327
 
320
328
  [View file →](src/libs/get/getQueryParams.ts)
@@ -324,10 +332,10 @@ console.log(params) // '123'
324
332
  A function that converts a pixel value to rem units.
325
333
 
326
334
  ```ts
327
- import { getRem } from 'umaki'
335
+ import { getRem } from "umaki";
328
336
 
329
- const remValue = getRem(16)
330
- console.log(remValue) // '1rem'
337
+ const remValue = getRem(16);
338
+ console.log(remValue); // '1rem'
331
339
  ```
332
340
 
333
341
  [View file →](src/libs/get/getRem.ts)
@@ -337,10 +345,10 @@ console.log(remValue) // '1rem'
337
345
  A function that retrieves the width of the scrollbar.
338
346
 
339
347
  ```ts
340
- import { getScrollbarWidth } from 'umaki'
348
+ import { getScrollbarWidth } from "umaki";
341
349
 
342
- const scrollbarWidth = getScrollbarWidth()
343
- console.log(scrollbarWidth) // 15
350
+ const scrollbarWidth = getScrollbarWidth();
351
+ console.log(scrollbarWidth); // 15
344
352
  ```
345
353
 
346
354
  [View file →](src/libs/get/getScrollbarWidth.ts)
@@ -350,10 +358,10 @@ console.log(scrollbarWidth) // 15
350
358
  A function that retrieves a value from session storage.
351
359
 
352
360
  ```ts
353
- import { getSessionStorage } from 'umaki'
361
+ import { getSessionStorage } from "umaki";
354
362
 
355
- const value = getSessionStorage('testKey')
356
- console.log(value) // 'testValue'
363
+ const value = getSessionStorage("testKey");
364
+ console.log(value); // 'testValue'
357
365
  ```
358
366
 
359
367
  [View file →](src/libs/get/getSessionStorage.ts)
@@ -363,10 +371,10 @@ console.log(value) // 'testValue'
363
371
  A function that retrieves the length of a string (considering Unicode characters).
364
372
 
365
373
  ```ts
366
- import { getStringLength } from 'umaki'
374
+ import { getStringLength } from "umaki";
367
375
 
368
- const length = getStringLength('こんにちは')
369
- console.log(length) // 5
376
+ const length = getStringLength("こんにちは");
377
+ console.log(length); // 5
370
378
  ```
371
379
 
372
380
  [View file →](src/libs/get/getStringLength.ts)
@@ -376,10 +384,10 @@ console.log(length) // 5
376
384
  A function that retrieves the value of the specified CSS custom property.
377
385
 
378
386
  ```ts
379
- import { getStylePropertyValue } from 'umaki'
387
+ import { getStylePropertyValue } from "umaki";
380
388
 
381
- const value = getStylePropertyValue('--custom-property')
382
- console.log(value)
389
+ const value = getStylePropertyValue("--custom-property");
390
+ console.log(value);
383
391
  ```
384
392
 
385
393
  [View file →](src/libs/get/getStylePropertyValue.ts)
@@ -389,10 +397,10 @@ console.log(value)
389
397
  A function that retrieves the value of the specified CSS custom property as a number.
390
398
 
391
399
  ```ts
392
- import { getStylePropertyValueToNumber } from 'umaki'
400
+ import { getStylePropertyValueToNumber } from "umaki";
393
401
 
394
- const value = getStylePropertyValueToNumber('--custom-property')
395
- console.log(value)
402
+ const value = getStylePropertyValueToNumber("--custom-property");
403
+ console.log(value);
396
404
  ```
397
405
 
398
406
  [View file →](src/libs/get/getStylePropertyValueToNumber.ts)
@@ -402,10 +410,10 @@ console.log(value)
402
410
  A function that retrieves user agent information.
403
411
 
404
412
  ```ts
405
- import { getUaData } from 'umaki'
413
+ import { getUaData } from "umaki";
406
414
 
407
- const uaData = getUaData()
408
- console.log(uaData)
415
+ const uaData = getUaData();
416
+ console.log(uaData);
409
417
  // {
410
418
  // browserName: 'chrome',
411
419
  // browserVersion: '91.0.4472.124',
@@ -425,12 +433,12 @@ console.log(uaData)
425
433
  A function that checks if the current date is between two specified dates.
426
434
 
427
435
  ```ts
428
- import { isBetweenDateTime } from 'umaki'
436
+ import { isBetweenDateTime } from "umaki";
429
437
 
430
- const dateA = '2023-10-01'
431
- const dateB = '2023-10-10'
432
- const result = isBetweenDateTime(dateA, dateB)
433
- console.log(result) // true or false
438
+ const dateA = "2023-10-01";
439
+ const dateB = "2023-10-10";
440
+ const result = isBetweenDateTime(dateA, dateB);
441
+ console.log(result); // true or false
434
442
  ```
435
443
 
436
444
  [View file →](src/libs/is/isBetweenDateTime.ts)
@@ -440,11 +448,14 @@ console.log(result) // true or false
440
448
  A function that checks if all elements exist.
441
449
 
442
450
  ```ts
443
- import { isExistAllElements } from 'umaki'
451
+ import { isExistAllElements } from "umaki";
444
452
 
445
- const elements = [document.createElement('div'), document.createElement('span')]
446
- const result = isExistAllElements(elements)
447
- console.log(result) // true or false
453
+ const elements = [
454
+ document.createElement("div"),
455
+ document.createElement("span"),
456
+ ];
457
+ const result = isExistAllElements(elements);
458
+ console.log(result); // true or false
448
459
  ```
449
460
 
450
461
  [View file →](src/libs/is/isExistAllElements.ts)
@@ -454,10 +465,10 @@ console.log(result) // true or false
454
465
  A function that checks if the device is an iPad.
455
466
 
456
467
  ```ts
457
- import { isIpad } from 'umaki'
468
+ import { isIpad } from "umaki";
458
469
 
459
- const result = isIpad()
460
- console.log(result) // true or false
470
+ const result = isIpad();
471
+ console.log(result); // true or false
461
472
  ```
462
473
 
463
474
  [View file →](src/libs/is/isIpad.ts)
@@ -467,11 +478,11 @@ console.log(result) // true or false
467
478
  A function that checks if a specific key exists in an object.
468
479
 
469
480
  ```ts
470
- import { isKeyExists } from 'umaki'
481
+ import { isKeyExists } from "umaki";
471
482
 
472
- const obj = { a: 1, b: 2 }
473
- const result = isKeyExists(obj, 'a')
474
- console.log(result) // true or false
483
+ const obj = { a: 1, b: 2 };
484
+ const result = isKeyExists(obj, "a");
485
+ console.log(result); // true or false
475
486
  ```
476
487
 
477
488
  [View file →](src/libs/is/isKeyExists.ts)
@@ -481,10 +492,10 @@ console.log(result) // true or false
481
492
  A function that checks if the browser is Safari.
482
493
 
483
494
  ```ts
484
- import { isSafari } from 'umaki'
495
+ import { isSafari } from "umaki";
485
496
 
486
- const result = isSafari()
487
- console.log(result) // true or false
497
+ const result = isSafari();
498
+ console.log(result); // true or false
488
499
  ```
489
500
 
490
501
  [View file →](src/libs/is/isSafari.ts)
@@ -494,13 +505,13 @@ console.log(result) // true or false
494
505
  A function that checks if an element is scrollable.
495
506
 
496
507
  ```ts
497
- import { isScrollable } from 'umaki'
508
+ import { isScrollable } from "umaki";
498
509
 
499
- const element = document.createElement('div')
500
- element.style.overflow = 'auto'
501
- element.innerHTML = '<div style="height: 200px;"></div>'
502
- const result = isScrollable(element)
503
- console.log(result) // true or false
510
+ const element = document.createElement("div");
511
+ element.style.overflow = "auto";
512
+ element.innerHTML = '<div style="height: 200px;"></div>';
513
+ const result = isScrollable(element);
514
+ console.log(result); // true or false
504
515
  ```
505
516
 
506
517
  [View file →](src/libs/is/isScrollable.ts)
@@ -510,10 +521,10 @@ console.log(result) // true or false
510
521
  A function that checks if the device supports touch.
511
522
 
512
523
  ```ts
513
- import { isTouchSupport } from 'umaki'
524
+ import { isTouchSupport } from "umaki";
514
525
 
515
- const result = isTouchSupport()
516
- console.log(result) // true or false
526
+ const result = isTouchSupport();
527
+ console.log(result); // true or false
517
528
  ```
518
529
 
519
530
  [View file →](src/libs/is/isTouchSupport.ts)
@@ -525,11 +536,11 @@ console.log(result) // true or false
525
536
  A function that removes all HTML tags from a string.
526
537
 
527
538
  ```ts
528
- import { removeAllHtmlTags } from 'umaki'
539
+ import { removeAllHtmlTags } from "umaki";
529
540
 
530
- const input = '<p>Hello <strong>World</strong>!</p>'
531
- const output = removeAllHtmlTags(input)
532
- console.log(output) // 'Hello World!'
541
+ const input = "<p>Hello <strong>World</strong>!</p>";
542
+ const output = removeAllHtmlTags(input);
543
+ console.log(output); // 'Hello World!'
533
544
  ```
534
545
 
535
546
  [View file →](src/libs/remove/removeAllHtmlTags.ts)
@@ -539,12 +550,12 @@ console.log(output) // 'Hello World!'
539
550
  A function that removes an attribute from the specified HTML element.
540
551
 
541
552
  ```ts
542
- import { removeAttribute } from 'umaki'
553
+ import { removeAttribute } from "umaki";
543
554
 
544
- const element = document.createElement('div')
545
- element.setAttribute('data-test', 'value')
546
- removeAttribute(element, 'data-test')
547
- console.log(element.hasAttribute('data-test')) // false
555
+ const element = document.createElement("div");
556
+ element.setAttribute("data-test", "value");
557
+ removeAttribute(element, "data-test");
558
+ console.log(element.hasAttribute("data-test")); // false
548
559
  ```
549
560
 
550
561
  [View file →](src/libs/remove/removeAttribute.ts)
@@ -554,11 +565,11 @@ console.log(element.hasAttribute('data-test')) // false
554
565
  A function that removes an item with the specified key from session storage.
555
566
 
556
567
  ```ts
557
- import { removeSessionStorage } from 'umaki'
568
+ import { removeSessionStorage } from "umaki";
558
569
 
559
- const key = 'testKey'
560
- removeSessionStorage(key)
561
- console.log(sessionStorage.getItem(key)) // null
570
+ const key = "testKey";
571
+ removeSessionStorage(key);
572
+ console.log(sessionStorage.getItem(key)); // null
562
573
  ```
563
574
 
564
575
  [View file →](src/libs/remove/removeSessionStorage.ts)
@@ -568,11 +579,11 @@ console.log(sessionStorage.getItem(key)) // null
568
579
  A function that removes the specified CSS custom property.
569
580
 
570
581
  ```ts
571
- import { removeStylePropertyValue } from 'umaki'
582
+ import { removeStylePropertyValue } from "umaki";
572
583
 
573
- const key = '--custom-property'
574
- removeStylePropertyValue(key)
575
- console.log(getComputedStyle(document.documentElement).getPropertyValue(key)) // ''
584
+ const key = "--custom-property";
585
+ removeStylePropertyValue(key);
586
+ console.log(getComputedStyle(document.documentElement).getPropertyValue(key)); // ''
576
587
  ```
577
588
 
578
589
  [View file →](src/libs/remove/removeStylePropertyValue.ts)
@@ -584,9 +595,9 @@ console.log(getComputedStyle(document.documentElement).getPropertyValue(key)) //
584
595
  A function that sets a CSS variable to 100vh to address viewport unit issues on mobile devices.
585
596
 
586
597
  ```ts
587
- import { set100vh } from 'umaki'
598
+ import { set100vh } from "umaki";
588
599
 
589
- set100vh()
600
+ set100vh();
590
601
  ```
591
602
 
592
603
  [View file →](src/libs/set/set100vh.ts)
@@ -596,9 +607,9 @@ set100vh()
596
607
  A function that sets a CSS variable to 100vw minus the scrollbar width.
597
608
 
598
609
  ```ts
599
- import { set100vw } from 'umaki'
610
+ import { set100vw } from "umaki";
600
611
 
601
- set100vw()
612
+ set100vw();
602
613
  ```
603
614
 
604
615
  [View file →](src/libs/set/set100vw.ts)
@@ -608,11 +619,11 @@ set100vw()
608
619
  A function that sets an attribute on the specified HTML element.
609
620
 
610
621
  ```ts
611
- import { setAttribute } from 'umaki'
622
+ import { setAttribute } from "umaki";
612
623
 
613
- const element = document.createElement('div')
614
- setAttribute(element, 'data-test', 'value')
615
- console.log(element.getAttribute('data-test')) // 'value'
624
+ const element = document.createElement("div");
625
+ setAttribute(element, "data-test", "value");
626
+ console.log(element.getAttribute("data-test")); // 'value'
616
627
  ```
617
628
 
618
629
  [View file →](src/libs/set/setAttribute.ts)
@@ -622,11 +633,11 @@ console.log(element.getAttribute('data-test')) // 'value'
622
633
  A function that adjusts the horizontal scroll position of the root element to center the target element.
623
634
 
624
635
  ```ts
625
- import { setScrollPositionToCenter } from 'umaki'
636
+ import { setScrollPositionToCenter } from "umaki";
626
637
 
627
- const rootElement = document.getElementById('root')
628
- const targetElement = document.getElementById('target')
629
- setScrollPositionToCenter(rootElement, targetElement)
638
+ const rootElement = document.getElementById("root");
639
+ const targetElement = document.getElementById("target");
640
+ setScrollPositionToCenter(rootElement, targetElement);
630
641
  ```
631
642
 
632
643
  [View file →](src/libs/set/setScrollPositionToCenter.ts)
@@ -636,12 +647,12 @@ setScrollPositionToCenter(rootElement, targetElement)
636
647
  A function that sets a value in session storage.
637
648
 
638
649
  ```ts
639
- import { setSessionStorage } from 'umaki'
650
+ import { setSessionStorage } from "umaki";
640
651
 
641
- const key = 'testKey'
642
- const value = 'testValue'
643
- setSessionStorage(key, value)
644
- console.log(sessionStorage.getItem(key)) // 'testValue'
652
+ const key = "testKey";
653
+ const value = "testValue";
654
+ setSessionStorage(key, value);
655
+ console.log(sessionStorage.getItem(key)); // 'testValue'
645
656
  ```
646
657
 
647
658
  [View file →](src/libs/set/setSessionStorage.ts)
@@ -651,12 +662,12 @@ console.log(sessionStorage.getItem(key)) // 'testValue'
651
662
  A function that sets a CSS custom property on the root element.
652
663
 
653
664
  ```ts
654
- import { setStylePropertyValue } from 'umaki'
665
+ import { setStylePropertyValue } from "umaki";
655
666
 
656
- const key = '--custom-color'
657
- const value = 'blue'
658
- setStylePropertyValue(key, value)
659
- console.log(getComputedStyle(document.documentElement).getPropertyValue(key)) // 'blue'
667
+ const key = "--custom-color";
668
+ const value = "blue";
669
+ setStylePropertyValue(key, value);
670
+ console.log(getComputedStyle(document.documentElement).getPropertyValue(key)); // 'blue'
660
671
  ```
661
672
 
662
673
  [View file →](src/libs/set/setStylePropertyValue.ts)
@@ -668,11 +679,11 @@ console.log(getComputedStyle(document.documentElement).getPropertyValue(key)) //
668
679
  A function that converts a string to a boolean value.
669
680
 
670
681
  ```ts
671
- import { toBoolean } from 'umaki'
682
+ import { toBoolean } from "umaki";
672
683
 
673
- console.log(toBoolean('true')) // true
674
- console.log(toBoolean('false')) // false
675
- console.log(toBoolean('random')) // false
684
+ console.log(toBoolean("true")); // true
685
+ console.log(toBoolean("false")); // false
686
+ console.log(toBoolean("random")); // false
676
687
  ```
677
688
 
678
689
  [View file →](src/libs/to/toBoolean.ts)
@@ -682,13 +693,13 @@ console.log(toBoolean('random')) // false
682
693
  A function that converts a number to a positive number. Returns the absolute value if the number is negative.
683
694
 
684
695
  ```ts
685
- import { toPositiveNumber } from 'umaki'
696
+ import { toPositiveNumber } from "umaki";
686
697
 
687
- console.log(toPositiveNumber(5)) // 5
688
- console.log(toPositiveNumber(-5)) // 5
689
- console.log(toPositiveNumber(0)) // 0
690
- console.log(toPositiveNumber(-3.14)) // 3.14
691
- console.log(toPositiveNumber(3.14)) // 3.14
698
+ console.log(toPositiveNumber(5)); // 5
699
+ console.log(toPositiveNumber(-5)); // 5
700
+ console.log(toPositiveNumber(0)); // 0
701
+ console.log(toPositiveNumber(-3.14)); // 3.14
702
+ console.log(toPositiveNumber(3.14)); // 3.14
692
703
  ```
693
704
 
694
705
  [View file →](src/libs/to/toPositiveNumber.ts)
@@ -700,12 +711,12 @@ console.log(toPositiveNumber(3.14)) // 3.14
700
711
  A function that wraps each character of the text content of an HTML element with individual `<span>` elements.
701
712
 
702
713
  ```ts
703
- import { wrapTextWithSpans } from 'umaki'
714
+ import { wrapTextWithSpans } from "umaki";
704
715
 
705
- const element = document.createElement('div')
706
- element.textContent = 'hello'
707
- wrapTextWithSpans(element)
708
- console.log(element.innerHTML) // '<span>h</span><span>e</span><span>l</span><span>l</span><span>o</span>'
716
+ const element = document.createElement("div");
717
+ element.textContent = "hello";
718
+ wrapTextWithSpans(element);
719
+ console.log(element.innerHTML); // '<span>h</span><span>e</span><span>l</span><span>l</span><span>o</span>'
709
720
  ```
710
721
 
711
722
  [View file →](src/libs/transform/wrapTextWithSpans.ts)
@@ -717,13 +728,12 @@ console.log(element.innerHTML) // '<span>h</span><span>e</span><span>l</span><sp
717
728
  A function that pauses execution for a specified amount of time.
718
729
 
719
730
  ```ts
720
- import { sleep } from 'umaki'
721
-
722
- ;(async () => {
723
- console.log('Start')
724
- await sleep(1) // 1s wait
725
- console.log('End')
726
- })()
731
+ import { sleep } from "umaki";
732
+ (async () => {
733
+ console.log("Start");
734
+ await sleep(1); // 1s wait
735
+ console.log("End");
736
+ })();
727
737
  ```
728
738
 
729
739
  [View file →](src/libs/wait/sleep.ts)
@@ -733,16 +743,15 @@ import { sleep } from 'umaki'
733
743
  A function that waits until all images and videos in the document are fully loaded.
734
744
 
735
745
  ```ts
736
- import { waitForAllMediaLoaded } from 'umaki'
737
-
738
- ;(async () => {
739
- const allMediaLoaded = await waitForAllMediaLoaded()
740
- console.log(allMediaLoaded) // true or false
746
+ import { waitForAllMediaLoaded } from "umaki";
747
+ (async () => {
748
+ const allMediaLoaded = await waitForAllMediaLoaded();
749
+ console.log(allMediaLoaded); // true or false
741
750
 
742
751
  // first view only
743
- const firstViewMediaLoaded = await waitForAllMediaLoaded(true)
744
- console.log(firstViewMediaLoaded) // true or false
745
- })()
752
+ const firstViewMediaLoaded = await waitForAllMediaLoaded(true);
753
+ console.log(firstViewMediaLoaded); // true or false
754
+ })();
746
755
  ```
747
756
 
748
757
  [View file →](src/libs/wait/waitForAllMediaLoaded.ts)
@@ -755,15 +764,15 @@ Specific usage for frameworks or various tools is described below.
755
764
 
756
765
  When using with Astro for SSR, add `umaki` to `vite.ssr.noExternal.`
757
766
 
758
- ``` ts
767
+ ```ts
759
768
  // astro.config.ts
760
769
  export default defineConfig(({ mode }) => {
761
770
  return {
762
771
  vite: {
763
772
  ssr: {
764
- noExternal: ['umaki']
765
- }
766
- }
767
- }
768
- })
773
+ noExternal: ["umaki"],
774
+ },
775
+ },
776
+ };
777
+ });
769
778
  ```