aneka 0.17.6 → 0.17.7

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 (147) hide show
  1. package/.jsdoc.conf.json +0 -0
  2. package/CHANGES.md +87 -83
  3. package/LICENSE +21 -21
  4. package/README.md +63 -63
  5. package/docs/arrange-array.js.html +0 -0
  6. package/docs/create-class.js.html +0 -0
  7. package/docs/current-loc.js.html +0 -0
  8. package/docs/data/search.json +0 -0
  9. package/docs/defaults-deep.js.html +0 -0
  10. package/docs/delay.js.html +0 -0
  11. package/docs/extract-text.js.html +0 -0
  12. package/docs/fill-object.js.html +0 -0
  13. package/docs/filter-duplicate.js.html +0 -0
  14. package/docs/filter-index.js.html +0 -0
  15. package/docs/fonts/Inconsolata-Regular.ttf +0 -0
  16. package/docs/fonts/OpenSans-Regular.ttf +0 -0
  17. package/docs/fonts/WorkSans-Bold.ttf +0 -0
  18. package/docs/format-text.js.html +0 -0
  19. package/docs/generate-id.js.html +0 -0
  20. package/docs/get-caller-filename.js.html +0 -0
  21. package/docs/get-global-module-dir.js.html +0 -0
  22. package/docs/get-index.js.html +0 -0
  23. package/docs/get-key-by-value.js.html +0 -0
  24. package/docs/global.html +0 -0
  25. package/docs/includes.js.html +0 -0
  26. package/docs/index.html +0 -0
  27. package/docs/is-class.js.html +0 -0
  28. package/docs/is-set.js.html +0 -0
  29. package/docs/merge-objects-by-key.js.html +0 -0
  30. package/docs/paginate.js.html +0 -0
  31. package/docs/parse-args-argv.js.html +0 -0
  32. package/docs/parse-duration.js.html +0 -0
  33. package/docs/parse-env.js.html +0 -0
  34. package/docs/parse-kv-string.js.html +0 -0
  35. package/docs/parse-object.js.html +0 -0
  36. package/docs/pascal-case.js.html +0 -0
  37. package/docs/random-range.js.html +0 -0
  38. package/docs/resolve-path.js.html +0 -0
  39. package/docs/round.js.html +0 -0
  40. package/docs/scripts/core.js +0 -0
  41. package/docs/scripts/core.min.js +0 -0
  42. package/docs/scripts/resize.js +0 -0
  43. package/docs/scripts/search.js +0 -0
  44. package/docs/scripts/search.min.js +5 -5
  45. package/docs/scripts/third-party/Apache-License-2.0.txt +0 -0
  46. package/docs/scripts/third-party/fuse.js +0 -0
  47. package/docs/scripts/third-party/hljs-line-num-original.js +0 -0
  48. package/docs/scripts/third-party/hljs-line-num.js +0 -0
  49. package/docs/scripts/third-party/hljs-original.js +0 -0
  50. package/docs/scripts/third-party/hljs.js +0 -0
  51. package/docs/scripts/third-party/popper.js +0 -0
  52. package/docs/scripts/third-party/tippy.js +0 -0
  53. package/docs/scripts/third-party/tocbot.js +0 -0
  54. package/docs/scripts/third-party/tocbot.min.js +0 -0
  55. package/docs/sec-to-hms.js.html +0 -0
  56. package/docs/set-immediate.js.html +0 -0
  57. package/docs/set-interval.js.html +0 -0
  58. package/docs/set-timeout.js.html +0 -0
  59. package/docs/shim.js.html +0 -0
  60. package/docs/static/bitcoin.jpeg +0 -0
  61. package/docs/styles/clean-jsdoc-theme-base.css +0 -0
  62. package/docs/styles/clean-jsdoc-theme-dark.css +0 -0
  63. package/docs/styles/clean-jsdoc-theme-light.css +0 -0
  64. package/docs/styles/clean-jsdoc-theme-scrollbar.css +0 -0
  65. package/docs/styles/clean-jsdoc-theme-without-scrollbar.min.css +0 -0
  66. package/docs/styles/clean-jsdoc-theme.min.css +0 -0
  67. package/docs/text-to-array.js.html +0 -0
  68. package/docs/titleize.js.html +0 -0
  69. package/docs/without.js.html +0 -0
  70. package/index.js +119 -119
  71. package/package.json +48 -48
  72. package/src/arrange-array.js +25 -25
  73. package/src/create-class.js +35 -35
  74. package/src/current-loc.js +0 -0
  75. package/src/defaults-deep.js +20 -20
  76. package/src/delay.js +19 -19
  77. package/src/extract-text.js +23 -23
  78. package/src/fill-object.js +17 -17
  79. package/src/filter-duplicate.js +26 -26
  80. package/src/filter-index.js +17 -17
  81. package/src/format-text.js +88 -88
  82. package/src/generate-id.js +35 -35
  83. package/src/get-caller-filename.js +25 -25
  84. package/src/get-global-module-dir.js +24 -20
  85. package/src/get-index.js +15 -15
  86. package/src/get-key-by-value.js +12 -12
  87. package/src/includes.js +18 -18
  88. package/src/is-class.js +13 -13
  89. package/src/is-set.js +11 -11
  90. package/src/log.js +19 -19
  91. package/src/merge-objects-by-key.js +24 -24
  92. package/src/paginate.js +45 -45
  93. package/src/parse-args-argv.js +0 -0
  94. package/src/parse-duration.js +14 -14
  95. package/src/parse-env.js +0 -0
  96. package/src/parse-kv-string.js +21 -21
  97. package/src/parse-object.js +76 -76
  98. package/src/pascal-case.js +14 -14
  99. package/src/random-range.js +15 -15
  100. package/src/resolve-path.js +0 -0
  101. package/src/round.js +13 -13
  102. package/src/sec-to-hms.js +27 -27
  103. package/src/set-immediate.js +12 -12
  104. package/src/set-interval.js +56 -56
  105. package/src/set-timeout.js +34 -34
  106. package/src/shim.js +28 -28
  107. package/src/text-to-array.js +17 -17
  108. package/src/titleize.js +37 -37
  109. package/src/without.js +18 -18
  110. package/test/arrange-array.js +41 -41
  111. package/test/create-class.js +33 -33
  112. package/test/current-loc.js +24 -24
  113. package/test/defaults-deep.js +19 -19
  114. package/test/delay.js +17 -17
  115. package/test/extract-text.js +17 -17
  116. package/test/fill-object.js +17 -17
  117. package/test/filter-duplicate.js +19 -19
  118. package/test/filter-index.js +17 -17
  119. package/test/format-text.js +26 -26
  120. package/test/generate-id.js +28 -28
  121. package/test/get-caller-filename.js +22 -22
  122. package/test/get-global-module-dir.js +51 -51
  123. package/test/get-index.js +17 -17
  124. package/test/get-key-by-value.js +17 -17
  125. package/test/includes.js +18 -18
  126. package/test/is-class.js +19 -19
  127. package/test/is-set.js +21 -21
  128. package/test/log.js +47 -47
  129. package/test/merge-objects-by-key.js +19 -19
  130. package/test/paginate.js +24 -24
  131. package/test/parse-args-argv.js +63 -63
  132. package/test/parse-duration.js +18 -18
  133. package/test/parse-env.js +35 -35
  134. package/test/parse-kv-string.js +17 -17
  135. package/test/parse-object.js +30 -30
  136. package/test/pascal-case.js +18 -18
  137. package/test/random-range.js +21 -21
  138. package/test/resolve-path.js +22 -22
  139. package/test/round.js +19 -19
  140. package/test/sec-to-hms.js +18 -18
  141. package/test/set-immediate.js +17 -17
  142. package/test/set-interval.js +196 -196
  143. package/test/set-timeout.js +120 -120
  144. package/test/shim.js +34 -34
  145. package/test/text-to-array.js +18 -18
  146. package/test/titleize.js +27 -27
  147. package/test/without.js +17 -17
package/.jsdoc.conf.json CHANGED
File without changes
package/CHANGES.md CHANGED
@@ -1,83 +1,87 @@
1
- # Changes
2
-
3
- ## 2026-08-20
4
-
5
- - [0.17.6] Bug fix in `setInterval()`
6
-
7
- ## 2026-08-06
8
-
9
- - [0.17.0] Add `setTimeout()`
10
- - [0.17.0] Add `setInterval()`
11
- - [0.17.1] Add `runFirst` option to `setInterval()`
12
- - [0.17.2] Drop `runFirst` option from `setInterval()`
13
- - [0.17.4] Update documentations & tests
14
- - [0.17.5] Bug fix in `setInterval()`: Ensure lock file exists before acquiring lock
15
-
16
- ## 2026-07-01
17
-
18
- - [0.16.0] Add `getGlobalModuleDir()`
19
-
20
- ## 2026-06-24
21
-
22
- - [0.15.0] Add documentations & tests
23
-
24
- ## 2026-06-01
25
-
26
- - [0.14.0] Add `getCallerFilename`
27
-
28
- ## 2026-03-10
29
-
30
- - [0.13.0] Add `textToArray`
31
- - [0.13.1] Bug fix in `index.js`
32
-
33
- ## 2026-02-20
34
-
35
- - [0.12.0] Add `without()`
36
-
37
- ## 2026-01-18
38
-
39
- - [0.11.1] `parseArgsArgv()` now accepts an object as its parameter
40
-
41
- ## 2025-12-25
42
-
43
- - [0.10.0] Add `parseKvString()`
44
-
45
- ## 2025-12-19
46
-
47
- - [0.9.0] Add `fillObject()`
48
-
49
- ## 2025-12-13
50
-
51
- - [0.6.0] Export functions as named export as well as default export
52
- - [0.6.0] Add `setImmediate()`
53
- - [0.6.0] Add `formatText()`
54
- - [0.6.0] Add `resolvePath()`
55
- - [0.6.0] Add `parseEnv()`
56
- - [0.6.0] Add `parseArgsArgv()`
57
- - [0.6.0] Add `parseDuration()`
58
- - [0.7.0] Add `parseObject()`
59
- - [0.7.1] Bug fix in `parseObject()`
60
- - [0.7.2] Bug fix in `parseArgsArgv()`
61
- - [0.7.3] Rewrite options in `parseObject()`
62
- - [0.7.4] Bug fix in `parseObject()`
63
- - [0.8.0] Add `randomRange()`
64
- - [0.8.0] Add `generateId()`
65
-
66
- ## 2025-12-11
67
-
68
- - [0.5.0] Add `mergeObjectsByKey(inputs, key)`
69
-
70
- ## 2025-12-10
71
-
72
- - [0.3.0] Add `filterIndex(inputs, matcher)`
73
- - [0.4.0] Add `filterDuplicate(inputs, key)`
74
- - [0.4.0] Add some test with mocha & chai
75
-
76
- ## 2025-12-09
77
-
78
- - [0.2.3] Bug fix on `getIndex()`
79
-
80
- ## 2025-12-05
81
-
82
- - [0.2.0] Add `getIndex(inputs, matcher)`
83
- - [0.2.1] Add above function to `index.js`
1
+ # Changes
2
+
3
+ ## 2026-09-04
4
+
5
+ - [0.17.7] Bug fix in `getGlobalModuleDir()`
6
+
7
+ ## 2026-08-20
8
+
9
+ - [0.17.6] Bug fix in `setInterval()`
10
+
11
+ ## 2026-08-06
12
+
13
+ - [0.17.0] Add `setTimeout()`
14
+ - [0.17.0] Add `setInterval()`
15
+ - [0.17.1] Add `runFirst` option to `setInterval()`
16
+ - [0.17.2] Drop `runFirst` option from `setInterval()`
17
+ - [0.17.4] Update documentations & tests
18
+ - [0.17.5] Bug fix in `setInterval()`: Ensure lock file exists before acquiring lock
19
+
20
+ ## 2026-07-01
21
+
22
+ - [0.16.0] Add `getGlobalModuleDir()`
23
+
24
+ ## 2026-06-24
25
+
26
+ - [0.15.0] Add documentations & tests
27
+
28
+ ## 2026-06-01
29
+
30
+ - [0.14.0] Add `getCallerFilename`
31
+
32
+ ## 2026-03-10
33
+
34
+ - [0.13.0] Add `textToArray`
35
+ - [0.13.1] Bug fix in `index.js`
36
+
37
+ ## 2026-02-20
38
+
39
+ - [0.12.0] Add `without()`
40
+
41
+ ## 2026-01-18
42
+
43
+ - [0.11.1] `parseArgsArgv()` now accepts an object as its parameter
44
+
45
+ ## 2025-12-25
46
+
47
+ - [0.10.0] Add `parseKvString()`
48
+
49
+ ## 2025-12-19
50
+
51
+ - [0.9.0] Add `fillObject()`
52
+
53
+ ## 2025-12-13
54
+
55
+ - [0.6.0] Export functions as named export as well as default export
56
+ - [0.6.0] Add `setImmediate()`
57
+ - [0.6.0] Add `formatText()`
58
+ - [0.6.0] Add `resolvePath()`
59
+ - [0.6.0] Add `parseEnv()`
60
+ - [0.6.0] Add `parseArgsArgv()`
61
+ - [0.6.0] Add `parseDuration()`
62
+ - [0.7.0] Add `parseObject()`
63
+ - [0.7.1] Bug fix in `parseObject()`
64
+ - [0.7.2] Bug fix in `parseArgsArgv()`
65
+ - [0.7.3] Rewrite options in `parseObject()`
66
+ - [0.7.4] Bug fix in `parseObject()`
67
+ - [0.8.0] Add `randomRange()`
68
+ - [0.8.0] Add `generateId()`
69
+
70
+ ## 2025-12-11
71
+
72
+ - [0.5.0] Add `mergeObjectsByKey(inputs, key)`
73
+
74
+ ## 2025-12-10
75
+
76
+ - [0.3.0] Add `filterIndex(inputs, matcher)`
77
+ - [0.4.0] Add `filterDuplicate(inputs, key)`
78
+ - [0.4.0] Add some test with mocha & chai
79
+
80
+ ## 2025-12-09
81
+
82
+ - [0.2.3] Bug fix on `getIndex()`
83
+
84
+ ## 2025-12-05
85
+
86
+ - [0.2.0] Add `getIndex(inputs, matcher)`
87
+ - [0.2.1] Add above function to `index.js`
package/LICENSE CHANGED
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) 2021 Ardhi Lukianto
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+ MIT License
2
+
3
+ Copyright (c) 2021 Ardhi Lukianto
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,64 +1,64 @@
1
- # aneka
2
-
3
- Aneka is a lightweight utility toolkit for everyday JavaScript and Node.js work.
4
- It provides practical helpers for common tasks like object parsing, deep defaults,
5
- text formatting, pagination, ID generation, time conversion, and array/object manipulation.
6
-
7
- Built as an ESM-first package, aneka is designed for projects that prefer
8
- small, focused utilities over large all-in-one frameworks.
9
-
10
- ## Why aneka?
11
-
12
- - Daily-use helpers in one package, with consistent function style
13
- - Safe and practical parsing tools for environment/config values
14
- - Utilities for strings, arrays, objects, and async timing flows
15
- - Works well for backend services, scripts, CLIs, and shared utility layers
16
-
17
- ## Install
18
-
19
- ```bash
20
- npm install aneka
21
- ```
22
-
23
- ## Quick start
24
-
25
- ```js
26
- import { parseObject, defaultsDeep, paginate, titleize } from 'aneka'
27
-
28
- const cfg = parseObject('{"port":"3000","enabled":"true"}', { parseValue: true })
29
- // => { port: 3000, enabled: true }
30
-
31
- const merged = defaultsDeep({ db: { host: 'localhost' } }, { db: { pool: 10 } })
32
- // => { db: { host: 'localhost', pool: 10 } }
33
-
34
- const page = paginate([{ id: 1 }, { id: 2 }, { id: 3 }], { page: 1, limit: 2 })
35
- // => { data: [{ id: 1 }, { id: 2 }], page: 1, limit: 2, count: 3, pages: 2 }
36
-
37
- titleize('the captain of the sea')
38
- // => 'The Captain of the Sea'
39
- ```
40
-
41
- ## Hire Me
42
-
43
- I'm the author of [Bajo Framework](https://bajo.app).
44
-
45
- If you have a Bajo Framework-based project and need a professional service or assistance, please <a href="https://github.com/ardhi#professional-service">click here</a>. I'd be happy to work on it at a competitive price and with fast turnaround!
46
-
47
- ## Support Me
48
-
49
- Please support me using the channels below. Your donation will motivate me to work faster and more diligently on future development.
50
-
51
- <a href="https://github.com/sponsors/ardhi">
52
- <img src="https://img.shields.io/badge/Github-slategrey?style=flat&logo=github" height="50">
53
- </a>
54
- <a href="https://www.paypal.com/ncp/payment/EWLERL7SCUU64">
55
- <img src="https://img.shields.io/badge/Paypal-blue?style=flat&logo=paypal" height="50">
56
- </a>
57
-
58
- <p>
59
- <div><img alt="bc1qwtv78cwp9ef8hnqaw84fxg5856l0pggqe32g6f" src="static/bitcoin.jpeg" width="150" height="150" /><br>Bitcoin</div>
60
- </p>
61
-
62
- ## License
63
-
1
+ # aneka
2
+
3
+ Aneka is a lightweight utility toolkit for everyday JavaScript and Node.js work.
4
+ It provides practical helpers for common tasks like object parsing, deep defaults,
5
+ text formatting, pagination, ID generation, time conversion, and array/object manipulation.
6
+
7
+ Built as an ESM-first package, aneka is designed for projects that prefer
8
+ small, focused utilities over large all-in-one frameworks.
9
+
10
+ ## Why aneka?
11
+
12
+ - Daily-use helpers in one package, with consistent function style
13
+ - Safe and practical parsing tools for environment/config values
14
+ - Utilities for strings, arrays, objects, and async timing flows
15
+ - Works well for backend services, scripts, CLIs, and shared utility layers
16
+
17
+ ## Install
18
+
19
+ ```bash
20
+ npm install aneka
21
+ ```
22
+
23
+ ## Quick start
24
+
25
+ ```js
26
+ import { parseObject, defaultsDeep, paginate, titleize } from 'aneka'
27
+
28
+ const cfg = parseObject('{"port":"3000","enabled":"true"}', { parseValue: true })
29
+ // => { port: 3000, enabled: true }
30
+
31
+ const merged = defaultsDeep({ db: { host: 'localhost' } }, { db: { pool: 10 } })
32
+ // => { db: { host: 'localhost', pool: 10 } }
33
+
34
+ const page = paginate([{ id: 1 }, { id: 2 }, { id: 3 }], { page: 1, limit: 2 })
35
+ // => { data: [{ id: 1 }, { id: 2 }], page: 1, limit: 2, count: 3, pages: 2 }
36
+
37
+ titleize('the captain of the sea')
38
+ // => 'The Captain of the Sea'
39
+ ```
40
+
41
+ ## Hire Me
42
+
43
+ I'm the author of [Bajo Framework](https://bajo.app).
44
+
45
+ If you have a Bajo Framework-based project and need a professional service or assistance, please <a href="https://github.com/ardhi#professional-service">click here</a>. I'd be happy to work on it at a competitive price and with fast turnaround!
46
+
47
+ ## Support Me
48
+
49
+ Please support me using the channels below. Your donation will motivate me to work faster and more diligently on future development.
50
+
51
+ <a href="https://github.com/sponsors/ardhi">
52
+ <img src="https://img.shields.io/badge/Github-slategrey?style=flat&logo=github" height="50">
53
+ </a>
54
+ <a href="https://www.paypal.com/ncp/payment/EWLERL7SCUU64">
55
+ <img src="https://img.shields.io/badge/Paypal-blue?style=flat&logo=paypal" height="50">
56
+ </a>
57
+
58
+ <p>
59
+ <div><img alt="bc1qwtv78cwp9ef8hnqaw84fxg5856l0pggqe32g6f" src="static/bitcoin.jpeg" width="150" height="150" /><br>Bitcoin</div>
60
+ </p>
61
+
62
+ ## License
63
+
64
64
  This project is licensed under the MIT License. See [LICENSE](LICENSE).
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
package/docs/global.html CHANGED
File without changes
File without changes
package/docs/index.html CHANGED
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -1,6 +1,6 @@
1
- const searchId="LiBfqbJVcV",searchHash="#"+searchId,searchContainer=document.querySelector("#PkfLWpAbet"),searchWrapper=document.querySelector("#iCxFxjkHbP"),searchCloseButton=document.querySelector("#VjLlGakifb"),searchInput=document.querySelector("#vpcKVYIppa"),resultBox=document.querySelector("#fWwVHRuDuN");function showResultText(e){resultBox.innerHTML=`<span class="search-result-c-text">${e}</span>`}function hideSearch(){window.location.hash===searchHash&&history.go(-1),window.onhashchange=null,searchContainer&&(searchContainer.style.display="none")}function listenCloseKey(e){"Escape"===e.key&&(hideSearch(),window.removeEventListener("keyup",listenCloseKey))}function showSearch(){try{hideMobileMenu()}catch(e){console.error(e)}window.onhashchange=hideSearch,window.location.hash!==searchHash&&history.pushState(null,null,searchHash),searchContainer&&(searchContainer.style.display="flex",window.addEventListener("keyup",listenCloseKey)),searchInput&&searchInput.focus()}async function fetchAllData(){var{hostname:e,protocol:t,port:n}=location,t=t+"//"+e+(""!==n?":"+n:"")+baseURL,e=new URL("data/search.json",t);const a=await fetch(e);n=(await a.json()).list;return n}function onClickSearchItem(t){const n=t.currentTarget;if(n){const a=n.getAttribute("href")||"";t=a.split("#")[1]||"";let e=document.getElementById(t);e||(t=decodeURI(t),e=document.getElementById(t)),e&&setTimeout(function(){bringElementIntoView(e)},100)}}function buildSearchResult(e){let t="";var n=/(<([^>]+)>)/gi;for(const s of e){const{title:c="",description:i=""}=s.item;var a=s.item.link.replace('<a href="',"").replace(/">.*/,""),o=c.replace(n,""),r=i.replace(n,"");t+=`
2
- <a onclick="onClickSearchItem(event)" href="${a}" class="search-result-item">
3
- <div class="search-result-item-title">${o}</div>
4
- <div class="search-result-item-p">${r||"No description available."}</div>
5
- </a>
1
+ const searchId="LiBfqbJVcV",searchHash="#"+searchId,searchContainer=document.querySelector("#PkfLWpAbet"),searchWrapper=document.querySelector("#iCxFxjkHbP"),searchCloseButton=document.querySelector("#VjLlGakifb"),searchInput=document.querySelector("#vpcKVYIppa"),resultBox=document.querySelector("#fWwVHRuDuN");function showResultText(e){resultBox.innerHTML=`<span class="search-result-c-text">${e}</span>`}function hideSearch(){window.location.hash===searchHash&&history.go(-1),window.onhashchange=null,searchContainer&&(searchContainer.style.display="none")}function listenCloseKey(e){"Escape"===e.key&&(hideSearch(),window.removeEventListener("keyup",listenCloseKey))}function showSearch(){try{hideMobileMenu()}catch(e){console.error(e)}window.onhashchange=hideSearch,window.location.hash!==searchHash&&history.pushState(null,null,searchHash),searchContainer&&(searchContainer.style.display="flex",window.addEventListener("keyup",listenCloseKey)),searchInput&&searchInput.focus()}async function fetchAllData(){var{hostname:e,protocol:t,port:n}=location,t=t+"//"+e+(""!==n?":"+n:"")+baseURL,e=new URL("data/search.json",t);const a=await fetch(e);n=(await a.json()).list;return n}function onClickSearchItem(t){const n=t.currentTarget;if(n){const a=n.getAttribute("href")||"";t=a.split("#")[1]||"";let e=document.getElementById(t);e||(t=decodeURI(t),e=document.getElementById(t)),e&&setTimeout(function(){bringElementIntoView(e)},100)}}function buildSearchResult(e){let t="";var n=/(<([^>]+)>)/gi;for(const s of e){const{title:c="",description:i=""}=s.item;var a=s.item.link.replace('<a href="',"").replace(/">.*/,""),o=c.replace(n,""),r=i.replace(n,"");t+=`
2
+ <a onclick="onClickSearchItem(event)" href="${a}" class="search-result-item">
3
+ <div class="search-result-item-title">${o}</div>
4
+ <div class="search-result-item-p">${r||"No description available."}</div>
5
+ </a>
6
6
  `}return t}function getSearchResult(e,t,n){var t={...{shouldSort:!0,threshold:.4,location:0,distance:100,maxPatternLength:32,minMatchCharLength:1,keys:t}},a=Fuse.createIndex(t.keys,e);const o=new Fuse(e,t,a),r=o.search(n);return 20<r.length?r.slice(0,20):r}function debounce(t,n,a){let o;return function(){const e=arguments;clearTimeout(o),o=setTimeout(()=>{o=null,a||t.apply(this,e)},n),a&&!o&&t.apply(this,e)}}let searchData;async function search(e){e=e.target.value;if(resultBox)if(e){if(!searchData){showResultText("Loading...");try{searchData=await fetchAllData()}catch(e){return console.log(e),void showResultText("Failed to load result.")}}e=getSearchResult(searchData,["title","description"],e);e.length?resultBox.innerHTML=buildSearchResult(e):showResultText("No result found! Try some different combination.")}else showResultText("Type anything to view search result");else console.error("Search result container not found")}function onDomContentLoaded(){const e=document.querySelectorAll(".search-button");var t=debounce(search,300);searchCloseButton&&searchCloseButton.addEventListener("click",hideSearch),e&&e.forEach(function(e){e.addEventListener("click",showSearch)}),searchContainer&&searchContainer.addEventListener("click",hideSearch),searchWrapper&&searchWrapper.addEventListener("click",function(e){e.stopPropagation()}),searchInput&&searchInput.addEventListener("keyup",t),window.location.hash===searchHash&&showSearch()}window.addEventListener("DOMContentLoaded",onDomContentLoaded),window.addEventListener("hashchange",function(){window.location.hash===searchHash&&showSearch()});
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
package/docs/shim.js.html CHANGED
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes