aneka 0.2.0 → 0.2.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.
package/CHANGES.md CHANGED
@@ -3,3 +3,4 @@
3
3
  ## 2025-12-05
4
4
 
5
5
  - [0.2.0] Add ```getIndex(inputs, matcher)```
6
+ - [0.2.1] Add above function to ```index.js```
package/index.js CHANGED
@@ -3,6 +3,7 @@ import defaultsDeep from './src/defaults-deep.js'
3
3
  import delay from './src/delay.js'
4
4
  import extractText from './src/extract-text.js'
5
5
  import getKeyByValue from './src/get-key-by-value.js'
6
+ import getIndex from './src/get-index.js'
6
7
  import includes from './src/includes.js'
7
8
  import isClass from './src/is-class.js'
8
9
  import isSet from './src/is-set.js'
@@ -18,6 +19,7 @@ export default {
18
19
  defaultsDeep,
19
20
  delay,
20
21
  extractText,
22
+ getIndex,
21
23
  getKeyByValue,
22
24
  includes,
23
25
  isClass,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aneka",
3
- "version": "0.2.0",
3
+ "version": "0.2.2",
4
4
  "description": "Some usefull function helper for daily use",
5
5
  "main": "src/index.js",
6
6
  "type": "module",
@@ -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
@@ -3,4 +3,6 @@ function getIndex (inputs = [], matcher) {
3
3
  if (matcher(val)) return idx
4
4
  return null
5
5
  }).filter(val => val !== null)
6
- }
6
+ }
7
+
8
+ export default getIndex