aneka 0.2.3 → 0.2.4

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.
package/CHANGES.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Changes
2
2
 
3
+ ## 2025-12-10
4
+
5
+ - [0.2.4] Add ```filterIndex(inputs, matcher)```
6
+
3
7
  ## 2025-12-09
4
8
 
5
9
  - [0.2.3] Bug fix on ```getIndex()```
package/index.js CHANGED
@@ -19,6 +19,7 @@ export default {
19
19
  defaultsDeep,
20
20
  delay,
21
21
  extractText,
22
+ filterIndex,
22
23
  getIndex,
23
24
  getKeyByValue,
24
25
  includes,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aneka",
3
- "version": "0.2.3",
3
+ "version": "0.2.4",
4
4
  "description": "Some usefull function helper for daily use",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Filter array's indexes
3
+ *
4
+ * @param {Array} inputs - Array to filter from
5
+ * @param {Object} matcher - Function to match conditions. If returns ```true```, the running index will be added to the result
6
+ * @returns {Array} Filtered indexes
7
+ */
8
+
9
+ function filterIndex (inputs, matcher) {
10
+ const indexes = inputs.reduce((accumulator, current, index) => {
11
+ if (matcher(current)) accumulator.push(index)
12
+ return accumulator
13
+ }, [])
14
+ return indexes
15
+ }
16
+
17
+ export default filterIndex