aneka 0.2.1 → 0.2.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.
package/CHANGES.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Changes
2
2
 
3
+ ## 2025-12-09
4
+
5
+ - [0.2.3] Bug fix on ```getIndex()```
6
+
3
7
  ## 2025-12-05
4
8
 
5
9
  - [0.2.0] Add ```getIndex(inputs, matcher)```
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "aneka",
3
- "version": "0.2.1",
3
+ "version": "0.2.3",
4
4
  "description": "Some usefull function helper for daily use",
5
- "main": "src/index.js",
5
+ "main": "index.js",
6
6
  "type": "module",
7
7
  "scripts": {
8
8
  "test": "jest"
@@ -0,0 +1,27 @@
1
+ function setProps (properties = {}, options = {}) {
2
+ for (const key in properties) {
3
+ this[key] = properties[key]
4
+ }
5
+ for (const key in options) {
6
+ this[key] = options[key]
7
+ }
8
+ }
9
+
10
+ function createClass (className, properties = {}, parent) {
11
+ let cls = class {
12
+ constructor (...options) {
13
+ setProps.call(this, properties, ...options)
14
+ }
15
+ }
16
+ if (parent) {
17
+ cls = class extends parent {
18
+ constructor (options) {
19
+ super(options)
20
+ setProps.call(this, properties, options)
21
+ }
22
+ }
23
+ }
24
+ return cls
25
+ }
26
+
27
+ export default createClass
package/src/get-index.js CHANGED
@@ -1,6 +1,8 @@
1
1
  function getIndex (inputs = [], matcher) {
2
- return indexes = inputs.map((val, idx) => {
2
+ return inputs.map((val, idx) => {
3
3
  if (matcher(val)) return idx
4
4
  return null
5
5
  }).filter(val => val !== null)
6
- }
6
+ }
7
+
8
+ export default getIndex