@thi.ng/fuzzy 2.1.125 → 2.1.126

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/README.md CHANGED
@@ -7,7 +7,7 @@
7
7
  [![Mastodon Follow](https://img.shields.io/mastodon/follow/109331703950160316?domain=https%3A%2F%2Fmastodon.thi.ng&style=social)](https://mastodon.thi.ng/@toxi)
8
8
 
9
9
  > [!NOTE]
10
- > This is one of 210 standalone projects, maintained as part
10
+ > This is one of 211 standalone projects, maintained as part
11
11
  > of the [@thi.ng/umbrella](https://github.com/thi-ng/umbrella/) monorepo
12
12
  > and anti-framework.
13
13
  >
package/defuzz.js CHANGED
@@ -4,7 +4,7 @@ import { snormMax, tnormMin } from "./tnorms.js";
4
4
  const defuzz = (ins, outs, rules, vals, strategy = centroidStrategy(), imply = tnormMin, combine = snormMax) => {
5
5
  const ruleTerms = rules.map((r) => {
6
6
  let alpha = null;
7
- for (let id in vals) {
7
+ for (const id in vals) {
8
8
  if (r.if[id]) {
9
9
  const v = ins[id].terms[r.if[id]](vals[id]);
10
10
  alpha = alpha !== null ? r.op(alpha, v) : v;
@@ -13,7 +13,7 @@ const defuzz = (ins, outs, rules, vals, strategy = centroidStrategy(), imply = t
13
13
  const terms = {};
14
14
  if (alpha) {
15
15
  const aterm = constant(alpha);
16
- for (let id in r.then) {
16
+ for (const id in r.then) {
17
17
  if (outs[id]) {
18
18
  const oterm = outs[id].terms[r.then[id]];
19
19
  terms[id] = intersect(
@@ -27,7 +27,7 @@ const defuzz = (ins, outs, rules, vals, strategy = centroidStrategy(), imply = t
27
27
  return terms;
28
28
  });
29
29
  const res = {};
30
- for (let id in outs) {
30
+ for (const id in outs) {
31
31
  res[id] = strategy(
32
32
  union(combine, ...ruleTerms.map((r) => r[id]).filter((f) => !!f)),
33
33
  outs[id].domain
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thi.ng/fuzzy",
3
- "version": "2.1.125",
3
+ "version": "2.1.126",
4
4
  "description": "Fuzzy logic operators & configurable rule inferencing engine",
5
5
  "type": "module",
6
6
  "module": "./index.js",
@@ -39,8 +39,8 @@
39
39
  "tool:tangle": "../../node_modules/.bin/tangle src/**/*.ts"
40
40
  },
41
41
  "dependencies": {
42
- "@thi.ng/api": "^8.12.9",
43
- "@thi.ng/math": "^5.13.6"
42
+ "@thi.ng/api": "^8.12.10",
43
+ "@thi.ng/math": "^5.14.0"
44
44
  },
45
45
  "devDependencies": {
46
46
  "esbuild": "^0.27.0",
@@ -104,5 +104,5 @@
104
104
  "thi.ng": {
105
105
  "year": 2020
106
106
  },
107
- "gitHead": "fdca77cabf47dd23a9ab17a5ca13e3060075c12c\n"
107
+ "gitHead": "824bf9047b5a10f777c5c5b4aeecf0c750a22c75\n"
108
108
  }
package/tnorms.js CHANGED
@@ -18,7 +18,7 @@ const snormDrastic = (x, y) => x === 0 ? y : y === 0 ? x : 1;
18
18
  const snormNilpotent = (x, y) => x + y < 1 ? Math.max(x, y) : 1;
19
19
  const snormEinstein = (x, y) => (x + y) / (1 + x * y);
20
20
  const ordinalSum = (specs) => (x, y) => {
21
- for (let s of specs) {
21
+ for (const s of specs) {
22
22
  const [a, b] = s.domain;
23
23
  if (x >= a && x <= b && y >= a && y <= b) {
24
24
  return a + (b - a) * s.tnorm(norm(x, a, b), norm(y, a, b));
package/var.js CHANGED
@@ -5,7 +5,7 @@ const variable = (domain, terms) => ({
5
5
  const classify = ({ terms }, x, threshold = 0) => {
6
6
  let max = threshold;
7
7
  let maxID;
8
- for (let id in terms) {
8
+ for (const id in terms) {
9
9
  const t = terms[id](x);
10
10
  if (t >= max) {
11
11
  max = t;
@@ -16,7 +16,7 @@ const classify = ({ terms }, x, threshold = 0) => {
16
16
  };
17
17
  const evaluate = ({ terms }, x) => {
18
18
  const res = {};
19
- for (let id in terms) {
19
+ for (const id in terms) {
20
20
  res[id] = terms[id](x);
21
21
  }
22
22
  return res;