@wizhut_tech/wizjs 0.1.0 → 0.1.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.
@@ -1,17 +1,17 @@
1
1
  const t = require('tap');
2
2
 
3
- const { cycle, fn_cycle } = require('../src/lang/itertools.js');
3
+ const { count, fn_count } = require('../src/lang/itertools.js');
4
4
 
5
5
 
6
- t.test('itertools/cycle', (t) => {
6
+ t.test('itertools/count', (t) => {
7
7
  // simple integer
8
- const genOne = cycle(0, 1);
8
+ const genOne = count(0, 1);
9
9
  t.equal(genOne.next().value, 0);
10
10
  t.equal(genOne.next().value, 1);
11
11
  t.equal(genOne.next().value, 2);
12
12
 
13
13
  // simple floating-point
14
- const genTwo = cycle(0, 0.5);
14
+ const genTwo = count(0, 0.5);
15
15
  t.equal(genTwo.next().value, 0);
16
16
  t.equal(genTwo.next().value, 0.5);
17
17
  t.equal(genTwo.next().value, 1);
@@ -1,4 +1,4 @@
1
1
  # Lang / itertools
2
2
 
3
- * **cycle(start, step=1)**: A generator that counts from *start* with a specified *step*. Default stepping is *1*.
4
- * **fn_cycle(start, step=1, fn)**: A generator that counts from *start* with a specified *step*. Default stepping is *1*. For each iteration the *fn* is called. To continue to the next iteration, the *fn* should return *true*. If not the iteration breaks,.
3
+ * **count(start, step=1)**: A generator that counts from *start* with a specified *step*. Default stepping is *1*.
4
+ * **fn_count(start, step=1, fn)**: A generator that counts from *start* with a specified *step*. Default stepping is *1*. For each iteration the *fn* is called. To continue to the next iteration, the *fn* should return *true*. If not the iteration breaks,.
package/index.js CHANGED
@@ -4,6 +4,8 @@ const numbers = require('./src/math/numbers.js');
4
4
  const functools = require('./src/lang/functools.js');
5
5
  const arrays = require('./src/lang/arrays.js');
6
6
  const files = require('./src/io/files.js');
7
+ const flow = require('./src/lang/flow.js');
8
+ const itertools = require('./src/lang/itertools.js');
7
9
 
8
10
  const { BadlyInitializedError } = require('./src/internal/exceptions.js');
9
11
 
@@ -15,8 +17,10 @@ module.exports = {
15
17
  lang: {
16
18
  arrays: arrays,
17
19
  singleton: singleton,
20
+ flow: flow,
18
21
  checks: checks,
19
- functools: functools
22
+ functools: functools,
23
+ itertools: itertools
20
24
  },
21
25
  math: {
22
26
  numbers: numbers
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wizhut_tech/wizjs",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "main": "index.js",
5
5
  "devDependencies": {
6
6
  "tap": "21.1.0"
package/readme.md CHANGED
@@ -16,7 +16,8 @@ Use by importing:
16
16
  checks: [functions],
17
17
  flow: [functions],
18
18
  singleton: [functions],
19
- functools: [functions]
19
+ functools: [functions],
20
+ itertools: [functions]
20
21
  },
21
22
  math: {
22
23
  numbers: [functions]
@@ -44,3 +45,7 @@ You can also import individual functions like the following snippet:
44
45
  ### Math
45
46
 
46
47
  * Utilities around **numbers** ... [[docs](docs/math_numbers.md)]
48
+
49
+ ## Contact
50
+
51
+ This library is actively developed and maintained by [wizhut.tech](http://wizhut.tech)
@@ -2,7 +2,7 @@
2
2
  const {toInteger} = require("../math/numbers");
3
3
 
4
4
 
5
- function* cycle(start=0, step=1) {
5
+ function* count(start=0, step=1) {
6
6
  let iCount = toInteger(start);
7
7
  const iStep = toInteger(step);
8
8
 
@@ -12,14 +12,14 @@ function* cycle(start=0, step=1) {
12
12
  }
13
13
  }
14
14
 
15
- function fn_cycle(start, fn, step=1) {
16
- const cycleGenerator = cycle(start, step);
15
+ function fn_count(start, fn, step=1) {
16
+ const countGenerator = count(start, step);
17
17
 
18
- while (fn(cycleGenerator.next().value)) { }
18
+ while (fn(countGenerator.next().value)) { }
19
19
  }
20
20
 
21
21
 
22
22
  module.exports = {
23
- cycle,
24
- fn_cycle
23
+ count,
24
+ fn_count
25
25
  };