@k37z3r/jbase 2.0.1 → 2.0.3

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 (167) hide show
  1. package/CHANGELOG.md +50 -0
  2. package/README.md +59 -43
  3. package/dist/browser.d.ts +5 -6
  4. package/dist/browser.d.ts.map +1 -1
  5. package/dist/core.d.ts +9 -14
  6. package/dist/core.d.ts.map +1 -1
  7. package/dist/index.cjs +577 -452
  8. package/dist/index.cjs.map +7 -0
  9. package/dist/index.d.ts +304 -603
  10. package/dist/index.d.ts.map +1 -1
  11. package/dist/index.mjs +575 -452
  12. package/dist/index.mjs.map +7 -0
  13. package/dist/jbase.browser.js +338 -281
  14. package/dist/jbase.browser.js.map +7 -0
  15. package/dist/jbase.min.js +3 -2
  16. package/dist/jbase.min.js.map +7 -0
  17. package/dist/modules/css/classes.d.ts +15 -29
  18. package/dist/modules/css/classes.d.ts.map +1 -1
  19. package/dist/modules/css/index.d.ts +5 -9
  20. package/dist/modules/css/index.d.ts.map +1 -1
  21. package/dist/modules/css/styles.d.ts +7 -13
  22. package/dist/modules/css/styles.d.ts.map +1 -1
  23. package/dist/modules/data/arrays.d.ts +96 -64
  24. package/dist/modules/data/arrays.d.ts.map +1 -1
  25. package/dist/modules/data/index.d.ts +5 -9
  26. package/dist/modules/data/index.d.ts.map +1 -1
  27. package/dist/modules/data/objects.d.ts +86 -54
  28. package/dist/modules/data/objects.d.ts.map +1 -1
  29. package/dist/modules/data/types.d.ts +3 -22
  30. package/dist/modules/data/types.d.ts.map +1 -1
  31. package/dist/modules/dom/attributes.d.ts +10 -19
  32. package/dist/modules/dom/attributes.d.ts.map +1 -1
  33. package/dist/modules/dom/content.d.ts +9 -17
  34. package/dist/modules/dom/content.d.ts.map +1 -1
  35. package/dist/modules/dom/index.d.ts +8 -15
  36. package/dist/modules/dom/index.d.ts.map +1 -1
  37. package/dist/modules/dom/manipulation.d.ts +41 -81
  38. package/dist/modules/dom/manipulation.d.ts.map +1 -1
  39. package/dist/modules/dom/states.d.ts +12 -23
  40. package/dist/modules/dom/states.d.ts.map +1 -1
  41. package/dist/modules/dom/traversal.d.ts +64 -127
  42. package/dist/modules/dom/traversal.d.ts.map +1 -1
  43. package/dist/modules/effects/fade.d.ts +13 -31
  44. package/dist/modules/effects/fade.d.ts.map +1 -1
  45. package/dist/modules/effects/index.d.ts +15 -23
  46. package/dist/modules/effects/index.d.ts.map +1 -1
  47. package/dist/modules/effects/slide.d.ts +13 -31
  48. package/dist/modules/effects/slide.d.ts.map +1 -1
  49. package/dist/modules/effects/types.d.ts +33 -0
  50. package/dist/modules/effects/types.d.ts.map +1 -0
  51. package/dist/modules/effects/vertical.d.ts +13 -31
  52. package/dist/modules/effects/vertical.d.ts.map +1 -1
  53. package/dist/modules/events/binding.d.ts +11 -21
  54. package/dist/modules/events/binding.d.ts.map +1 -1
  55. package/dist/modules/events/form.d.ts +18 -35
  56. package/dist/modules/events/form.d.ts.map +1 -1
  57. package/dist/modules/events/index.d.ts +9 -17
  58. package/dist/modules/events/index.d.ts.map +1 -1
  59. package/dist/modules/events/keyboard.d.ts +16 -31
  60. package/dist/modules/events/keyboard.d.ts.map +1 -1
  61. package/dist/modules/events/lifecycle.d.ts +6 -11
  62. package/dist/modules/events/lifecycle.d.ts.map +1 -1
  63. package/dist/modules/events/mouse.d.ts +30 -59
  64. package/dist/modules/events/mouse.d.ts.map +1 -1
  65. package/dist/modules/events/touch.d.ts +15 -29
  66. package/dist/modules/events/touch.d.ts.map +1 -1
  67. package/dist/modules/http/get.d.ts +18 -25
  68. package/dist/modules/http/get.d.ts.map +1 -1
  69. package/dist/modules/http/index.d.ts +11 -15
  70. package/dist/modules/http/index.d.ts.map +1 -1
  71. package/dist/modules/http/post.d.ts +13 -19
  72. package/dist/modules/http/post.d.ts.map +1 -1
  73. package/dist/server.d.ts +15 -0
  74. package/dist/server.d.ts.map +1 -0
  75. package/dist/server.js +2246 -0
  76. package/dist/server.js.map +7 -0
  77. package/dist/types.d.ts +11 -21
  78. package/dist/types.d.ts.map +1 -1
  79. package/dist/utils.d.ts +20 -23
  80. package/dist/utils.d.ts.map +1 -1
  81. package/package.json +14 -4
  82. package/wiki/CSS-Classes-&-Styles.md +128 -0
  83. package/wiki/DATA-Utilities-(Arrays).md +332 -0
  84. package/wiki/DATA-Utilities-(Objects).md +263 -0
  85. package/wiki/DOM-Attributes.md +56 -0
  86. package/wiki/DOM-Content.md +48 -0
  87. package/wiki/DOM-Manipulation.md +272 -0
  88. package/wiki/DOM-States.md +73 -0
  89. package/wiki/DOM-Traversal.md +529 -0
  90. package/wiki/EFFECTS-Fade.md +76 -0
  91. package/wiki/EFFECTS-Slide-(horizontal).md +70 -0
  92. package/wiki/EFFECTS-Slide-(vertical).md +75 -0
  93. package/wiki/EVENTS-Bindings.md +55 -0
  94. package/wiki/EVENTS-Form.md +122 -0
  95. package/wiki/EVENTS-Keyboard.md +98 -0
  96. package/wiki/EVENTS-Lifecycle.md +25 -0
  97. package/wiki/EVENTS-Mouse.md +218 -0
  98. package/wiki/EVENTS-Touch.md +98 -0
  99. package/wiki/HTTP-Requests.md +93 -0
  100. package/wiki/Home.md +118 -0
  101. package/wiki/Installation.md +44 -0
  102. package/wiki/Quick-Start.md +139 -0
  103. package/dist/browser.js +0 -29
  104. package/dist/browser.js.map +0 -1
  105. package/dist/core.js +0 -78
  106. package/dist/core.js.map +0 -1
  107. package/dist/index.js +0 -100
  108. package/dist/index.js.map +0 -1
  109. package/dist/jbase.js +0 -1898
  110. package/dist/modules/css/classes.js +0 -88
  111. package/dist/modules/css/classes.js.map +0 -1
  112. package/dist/modules/css/index.js +0 -33
  113. package/dist/modules/css/index.js.map +0 -1
  114. package/dist/modules/css/styles.js +0 -49
  115. package/dist/modules/css/styles.js.map +0 -1
  116. package/dist/modules/data/arrays.js +0 -177
  117. package/dist/modules/data/arrays.js.map +0 -1
  118. package/dist/modules/data/index.js +0 -33
  119. package/dist/modules/data/index.js.map +0 -1
  120. package/dist/modules/data/objects.js +0 -168
  121. package/dist/modules/data/objects.js.map +0 -1
  122. package/dist/modules/data/types.js +0 -43
  123. package/dist/modules/data/types.js.map +0 -1
  124. package/dist/modules/dom/attributes.js +0 -69
  125. package/dist/modules/dom/attributes.js.map +0 -1
  126. package/dist/modules/dom/content.js +0 -63
  127. package/dist/modules/dom/content.js.map +0 -1
  128. package/dist/modules/dom/index.js +0 -48
  129. package/dist/modules/dom/index.js.map +0 -1
  130. package/dist/modules/dom/manipulation.js +0 -343
  131. package/dist/modules/dom/manipulation.js.map +0 -1
  132. package/dist/modules/dom/states.js +0 -89
  133. package/dist/modules/dom/states.js.map +0 -1
  134. package/dist/modules/dom/traversal.js +0 -527
  135. package/dist/modules/dom/traversal.js.map +0 -1
  136. package/dist/modules/effects/fade.js +0 -104
  137. package/dist/modules/effects/fade.js.map +0 -1
  138. package/dist/modules/effects/index.js +0 -38
  139. package/dist/modules/effects/index.js.map +0 -1
  140. package/dist/modules/effects/slide.js +0 -103
  141. package/dist/modules/effects/slide.js.map +0 -1
  142. package/dist/modules/effects/vertical.js +0 -118
  143. package/dist/modules/effects/vertical.js.map +0 -1
  144. package/dist/modules/events/binding.js +0 -60
  145. package/dist/modules/events/binding.js.map +0 -1
  146. package/dist/modules/events/form.js +0 -106
  147. package/dist/modules/events/form.js.map +0 -1
  148. package/dist/modules/events/index.js +0 -53
  149. package/dist/modules/events/index.js.map +0 -1
  150. package/dist/modules/events/keyboard.js +0 -83
  151. package/dist/modules/events/keyboard.js.map +0 -1
  152. package/dist/modules/events/lifecycle.js +0 -40
  153. package/dist/modules/events/lifecycle.js.map +0 -1
  154. package/dist/modules/events/mouse.js +0 -172
  155. package/dist/modules/events/mouse.js.map +0 -1
  156. package/dist/modules/events/touch.js +0 -74
  157. package/dist/modules/events/touch.js.map +0 -1
  158. package/dist/modules/http/get.js +0 -65
  159. package/dist/modules/http/get.js.map +0 -1
  160. package/dist/modules/http/index.js +0 -42
  161. package/dist/modules/http/index.js.map +0 -1
  162. package/dist/modules/http/post.js +0 -54
  163. package/dist/modules/http/post.js.map +0 -1
  164. package/dist/types.js +0 -15
  165. package/dist/types.js.map +0 -1
  166. package/dist/utils.js +0 -71
  167. package/dist/utils.js.map +0 -1
package/package.json CHANGED
@@ -1,16 +1,18 @@
1
1
  {
2
2
  "name": "@k37z3r/jbase",
3
- "version": "2.0.1",
3
+ "version": "2.0.3",
4
4
  "description": "A modern micro-framework for the web: jBase offers the familiar syntax of classic DOM libraries, but without their baggage. Fully typed, modular, and optimized for modern browser engines.",
5
5
  "private": false,
6
6
  "main": "./dist/index.cjs",
7
7
  "module": "./dist/index.mjs",
8
8
  "browser": "./dist/jbase.min.js",
9
- "types": "dist/index.d.ts",
9
+ "types": "./dist/index.d.ts",
10
10
  "files": [
11
11
  "dist",
12
12
  "README.md",
13
- "LICENSE"
13
+ "LICENSE",
14
+ "CHANGELOG.md",
15
+ "wiki"
14
16
  ],
15
17
  "scripts": {
16
18
  "build:ts": "tsc",
@@ -33,9 +35,11 @@
33
35
  },
34
36
  "license": "GPL-3.0-or-later",
35
37
  "dependencies": {
38
+ "jsdom": "^28.0.0",
36
39
  "tslib": "^2.8.1"
37
40
  },
38
41
  "devDependencies": {
42
+ "@types/jsdom": "^27.0.0",
39
43
  "@types/node": "^22.0.0",
40
44
  "esbuild": "^0.27.2",
41
45
  "typescript": "^5.3.3"
@@ -53,6 +57,12 @@
53
57
  "types": "./dist/index.d.ts",
54
58
  "import": "./dist/index.mjs",
55
59
  "require": "./dist/index.cjs"
56
- }
60
+ },
61
+ "./server": {
62
+ "import": "./dist/server.js",
63
+ "types": "./dist/server.d.ts",
64
+ "require": "./dist/server.js"
65
+ },
66
+ "./browser": "./dist/jbase.min.js"
57
67
  }
58
68
  }
@@ -0,0 +1,128 @@
1
+ * [`css`](#usage-css)
2
+ * [`addClass`](#usage-addClass) | [`removeClass`](#usage-removeClass) | [`toggleClass`](#usage-toggleClass) | [`hasClass`](#usage-hasClass)
3
+
4
+ ---
5
+
6
+ ## <a id="usage-css"></a>.css
7
+
8
+ **Description**
9
+ Get the value of a computed style property for the first element in the set of matched elements or set one or more CSS properties for every matched element.
10
+
11
+ **Parameters**
12
+
13
+ * `property` (String|Object): A CSS property name or an object of property-value pairs.
14
+ * `value` (String|Number, optional): A value to set for the property.
15
+
16
+ **Returns**
17
+
18
+ * (String): The value of the property (if getter).
19
+ * (jBase): Current instance (if setter).
20
+
21
+ **Example**
22
+
23
+ ```javascript
24
+ // Get value
25
+ const color = $('.box').css('color');
26
+
27
+ // Set single value
28
+ $('.box').css('width', '500px');
29
+
30
+ // Set multiple values
31
+ $('.box').css({
32
+ 'background-color': 'blue',
33
+ 'font-size': '14px'
34
+ });
35
+
36
+ ```
37
+
38
+ ---
39
+
40
+ ## <a id="usage-addClass"></a>.addClass
41
+
42
+ **Description**
43
+ Adds the specified class(es) to each element in the set of matched elements.
44
+
45
+ **Parameters**
46
+
47
+ * `className` (String): One or more class names to be added to the class attribute of each matched element.
48
+
49
+ **Returns**
50
+
51
+ * (jBase): Current instance.
52
+
53
+ **Example**
54
+
55
+ ```javascript
56
+ $('p').addClass('lead text-muted');
57
+
58
+ ```
59
+
60
+ ---
61
+
62
+ ## <a id="usage-removeClass"></a>.removeClass
63
+
64
+ **Description**
65
+ Remove a single class, multiple classes, or all classes from each element in the set of matched elements.
66
+
67
+ **Parameters**
68
+
69
+ * `className` (String): One or more class names to be removed.
70
+
71
+ **Returns**
72
+
73
+ * (jBase): Current instance.
74
+
75
+ **Example**
76
+
77
+ ```javascript
78
+ $('.active').removeClass('active');
79
+
80
+ ```
81
+
82
+ ---
83
+
84
+ ## <a id="usage-toggleClass"></a>.toggleClass
85
+
86
+ **Description**
87
+ Add or remove one or more classes from each element in the set of matched elements, depending on either the class's presence or the value of the state argument.
88
+
89
+ **Parameters**
90
+
91
+ * `className` (String): One or more class names to be toggled.
92
+
93
+ **Returns**
94
+
95
+ * (jBase): Current instance.
96
+
97
+ **Example**
98
+
99
+ ```javascript
100
+ $('.btn').click(function() {
101
+ $(this).toggleClass('btn-active');
102
+ });
103
+
104
+ ```
105
+
106
+ ---
107
+
108
+ ## <a id="usage-hasClass"></a>.hasClass
109
+
110
+ **Description**
111
+ Determine whether any of the matched elements are assigned the given class.
112
+
113
+ **Parameters**
114
+
115
+ * `className` (String): The class name to search for.
116
+
117
+ **Returns**
118
+
119
+ * (Boolean): True if the class is present, false otherwise.
120
+
121
+ **Example**
122
+
123
+ ```javascript
124
+ if ($('#menu').hasClass('open')) {
125
+ $('#menu').slideUp();
126
+ }
127
+
128
+ ```
@@ -0,0 +1,332 @@
1
+ * [`chunk`](#usage-chunk) | [`mergeArray`](#usage-mergeArray) | [`add`](#usage-add)
2
+ * [`remove.at`](#usage-remove.at) | [`remove.first`](#usage-remove.first) | [`remove.last`](#usage-remove.last) | [`remove.byMatch`](#usage-remove.byMatch) | [`remove.all`](#usage-remove.all)
3
+ * [`findAt`](#usage-find-at) | [`findFirst`](#usage-find-first) | [`findLast`](#usage-find-last) | [`findAll`](#usage-find-all) | [`findByMatch`](#usage-find-byMatch)
4
+
5
+ ---
6
+
7
+ ## <a id="usage-chunk"></a>.chunk
8
+
9
+ **Description**
10
+ Creates an array of elements split into groups the length of `size`.
11
+
12
+ **Parameters**
13
+
14
+ * `array` (Array): The array to process.
15
+ * `size` (Number): The length of each chunk.
16
+
17
+ **Returns**
18
+
19
+ * (Array[]): An array containing the chunked arrays.
20
+
21
+ **Example**
22
+
23
+ ```javascript
24
+ const data = [1, 2, 3, 4, 5];
25
+ const chunks = $.data.chunk(data, 2);
26
+ // Result: [[1, 2], [3, 4], [5]]
27
+
28
+ ```
29
+
30
+ ---
31
+
32
+ ## <a id="usage-mergeArray"></a>.mergeArray
33
+
34
+ **Description**
35
+ Merges multiple arrays into a single, flat array.
36
+ *(Note: This creates a new array and does not modify the inputs).*
37
+
38
+ **Parameters**
39
+
40
+ * `...arrays` (Array[]): A list of arrays to merge (e.g. `arr1, arr2, arr3`).
41
+
42
+ **Returns**
43
+
44
+ * (Array): A new, single merged array.
45
+
46
+ **Example**
47
+
48
+ ```javascript
49
+ const a = [1, 2];
50
+ const b = [3, 4];
51
+ const c = [5, 6];
52
+ const result = $.data.mergeArray(a, b, c);
53
+ // Result: [1, 2, 3, 4, 5, 6]
54
+
55
+ ```
56
+
57
+ ---
58
+
59
+ ## <a id="usage-add"></a>.add
60
+
61
+ **Description**
62
+ Safely adds an element to the array at a specific position without mutating the original array (Immutable).
63
+
64
+ **Parameters**
65
+
66
+ * `array` (Array): The original array.
67
+ * `item` (Any): The item to add.
68
+ * `index` (Number, optional): The position to insert at. Defaults to the end (`array.length`). Negative values count from the back.
69
+
70
+ **Returns**
71
+
72
+ * (Array): A new array including the added element.
73
+
74
+ **Example**
75
+
76
+ ```javascript
77
+ const list = ['a', 'c'];
78
+ // Insert 'b' at index 1
79
+ const result = $.data.add(list, 'b', 1);
80
+ // Result: ['a', 'b', 'c']
81
+
82
+ ```
83
+
84
+ ---
85
+
86
+ ## <a id="usage-remove-at"></a>.remove.at
87
+
88
+ **Description**
89
+ Removes an element at a specific index and returns a new array. Supports negative indices to count from the end.
90
+
91
+ **Parameters**
92
+
93
+ * `array` (Array): The source array.
94
+ * `index` (Number): The index to remove. Negative values count from the back (e.g., `-1` is the last item).
95
+
96
+ **Returns**
97
+
98
+ * (Array): A new array without the item at the specified index.
99
+
100
+ **Example**
101
+
102
+ ```javascript
103
+ const numbers = [10, 20, 30, 40];
104
+ const result = $.data.remove.at(numbers, -2); // Removes 30
105
+ // Result: [10, 20, 40]
106
+ // Original 'numbers' array remains [10, 20, 30, 40]
107
+
108
+ ```
109
+
110
+ ---
111
+
112
+ ## <a id="usage-remove-first"></a>.remove.first
113
+
114
+ **Description**
115
+ Removes the first element of the array and returns the rest as a new array.
116
+
117
+ **Parameters**
118
+
119
+ * `array` (Array): The source array.
120
+
121
+ **Returns**
122
+
123
+ * (Array): A new array without the first element.
124
+
125
+ **Example**
126
+
127
+ ```javascript
128
+ const queue = ['Task 1', 'Task 2', 'Task 3'];
129
+ const nextQueue = $.data.remove.first(queue);
130
+ // Result: ['Task 2', 'Task 3']
131
+
132
+ ```
133
+
134
+ ---
135
+
136
+ ## <a id="usage-remove-last"></a>.remove.last
137
+
138
+ **Description**
139
+ Removes the last element of the array and returns the rest as a new array.
140
+
141
+ **Parameters**
142
+
143
+ * `array` (Array): The source array.
144
+
145
+ **Returns**
146
+
147
+ * (Array): A new array without the last element.
148
+
149
+ **Example**
150
+
151
+ ```javascript
152
+ const stack = ['A', 'B', 'C'];
153
+ const newStack = $.data.remove.last(stack);
154
+ // Result: ['A', 'B']
155
+
156
+ ```
157
+
158
+ ---
159
+
160
+ ## <a id="usage-remove-byMatch"></a>.remove.byMatch
161
+
162
+ **Description**
163
+ Removes **all** elements that match the search query condition.
164
+ *(This effectively acts as an inverse filter).*
165
+
166
+ **Parameters**
167
+
168
+ * `array` (Array): The source array.
169
+ * `query` (String|Number): The search term to match against.
170
+ * `mode` (String, optional): Comparison mode: `'exact'`, `'contains'`, `'startsWith'`, `'endsWith'`. Default is `'exact'`.
171
+ * `key` (String, optional): If the array contains objects, specify the property key to check.
172
+
173
+ **Returns**
174
+
175
+ * (Array): A new array containing only the items that **did not** match.
176
+
177
+ **Example**
178
+
179
+ ```javascript
180
+ const users = [
181
+ { id: 1, role: 'admin' },
182
+ { id: 2, role: 'user' },
183
+ { id: 3, role: 'admin' }
184
+ ];
185
+
186
+ // Remove all admins
187
+ const nonAdmins = $.data.remove.byMatch(users, 'admin', 'exact', 'role');
188
+ // Result: [{ id: 2, role: 'user' }]
189
+ ```
190
+
191
+ ---
192
+
193
+ ## <a id="usage-find-at"></a>.find.at
194
+
195
+ **Description**
196
+ Finds the **index** of the first element that matches the query.
197
+
198
+ **Parameters**
199
+
200
+ * `array` (Array): The array to search.
201
+ * `query` (String|Number): The search term.
202
+ * `mode` (String, optional): Comparison mode: `'exact'`, `'contains'`, `'startsWith'`, `'endsWith'`. Default is `'exact'`.
203
+ * `key` (String, optional): If the array contains objects, specify the property key to search in.
204
+
205
+ **Returns**
206
+
207
+ * (Number): The index of the match, or `-1` if not found.
208
+
209
+ **Example**
210
+
211
+ ```javascript
212
+ const users = [{id: 1, name: 'Alice'}, {id: 2, name: 'Bob'}];
213
+ // Find index of user with name starting with 'Bo'
214
+ const index = $.data.find.at(users, 'Bo', 'startsWith', 'name');
215
+ // Result: 1
216
+
217
+ ```
218
+
219
+ ---
220
+
221
+ ## <a id="usage-find-all"></a>.find.all
222
+
223
+ **Description**
224
+ Returns **all elements** (as a new array) that match the condition. Similar to `filter()`.
225
+
226
+ **Parameters**
227
+
228
+ * `array` (Array): The array to search.
229
+ * `query` (String|Number): The search term.
230
+ * `mode` (String, optional): `'exact'`, `'contains'`, `'startsWith'`, `'endsWith'`. Default is `'exact'`.
231
+ * `key` (String, optional): The object property key to check (if array of objects).
232
+
233
+ **Returns**
234
+
235
+ * (Array): An array containing all matching elements.
236
+
237
+ **Example**
238
+
239
+ ```javascript
240
+ const files = ['image.png', 'script.js', 'logo.png', 'style.css'];
241
+ // Find all .png files
242
+ const images = $.data.find.all(files, '.png', 'endsWith');
243
+ // Result: ['image.png', 'logo.png']
244
+
245
+ ```
246
+
247
+ ---
248
+
249
+ ## <a id="usage-find-first"></a>.find.first
250
+
251
+ **Description**
252
+ Returns the **first element** (the actual item, not the index) that matches the query.
253
+
254
+ **Parameters**
255
+
256
+ * `array` (Array): The array to search.
257
+ * `query` (String|Number): The search term.
258
+ * `mode` (String, optional): `'exact'`, `'contains'`, `'startsWith'`, `'endsWith'`. Default is `'exact'`.
259
+ * `key` (String, optional): The object property key to check.
260
+
261
+ **Returns**
262
+
263
+ * (Any | undefined): The found element, or `undefined`.
264
+
265
+ **Example**
266
+
267
+ ```javascript
268
+ const fruits = ['apple', 'banana', 'cherry'];
269
+ const match = $.data.find.first(fruits, 'nana', 'contains');
270
+ // Result: 'banana'
271
+
272
+ ```
273
+
274
+ ---
275
+
276
+ ## <a id="usage-find-last"></a>.find.last
277
+
278
+ **Description**
279
+ Returns the **last element** that matches the query. Searches the array in reverse order.
280
+
281
+ **Parameters**
282
+
283
+ * `array` (Array): The array to search.
284
+ * `query` (String|Number): The search term.
285
+ * `mode` (String, optional): `'exact'`, `'contains'`, `'startsWith'`, `'endsWith'`. Default is `'exact'`.
286
+ * `key` (String, optional): The object property key to check.
287
+
288
+ **Returns**
289
+
290
+ * (Any | undefined): The last matching element, or `undefined`.
291
+
292
+ **Example**
293
+
294
+ ```javascript
295
+ const log = [
296
+ { level: 'info', msg: 'Start' },
297
+ { level: 'error', msg: 'Fail' },
298
+ { level: 'info', msg: 'End' }
299
+ ];
300
+ // Find last info message
301
+ const lastInfo = $.data.find.last(log, 'info', 'exact', 'level');
302
+ // Result: { level: 'info', msg: 'End' }
303
+
304
+ ```
305
+
306
+ ---
307
+
308
+ ## <a id="usage-find-byMatch"></a>.find.byMatch
309
+
310
+ **Description**
311
+ Finds the **index** of the first match based on the query condition.
312
+ *(Note: Functionally similar to `find.at` in the current implementation).*
313
+
314
+ **Parameters**
315
+
316
+ * `array` (Array): The array to search.
317
+ * `query` (String|Number): The search term.
318
+ * `mode` (String, optional): `'exact'`, `'contains'`, `'startsWith'`, `'endsWith'`. Default is `'exact'`.
319
+ * `key` (String, optional): The object property key to check.
320
+
321
+ **Returns**
322
+
323
+ * (Number): The index of the match, or `-1`.
324
+
325
+ **Example**
326
+
327
+ ```javascript
328
+ const nums = [10, 20, 30, 40];
329
+ const idx = $.data.find.byMatch(nums, 30);
330
+ // Result: 2
331
+
332
+ ```