es6-fuzz 3.0.4 → 3.0.7

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/.gitattributes ADDED
@@ -0,0 +1 @@
1
+ * text=auto
package/.jscsrc CHANGED
@@ -14,7 +14,6 @@
14
14
  "disallowEmptyBlocks": true,
15
15
  "disallowSpacesInsideParentheses": true,
16
16
  "disallowSpaceAfterObjectKeys": true,
17
- "requireSpaceAfterBinaryOperators": true,
18
17
  "disallowSpaceBeforePostfixUnaryOperators": ["++", "--"],
19
18
  "requireSpaceBeforeBinaryOperators": [
20
19
  "=",
@@ -1,4 +1,6 @@
1
- # fuzzylogic for javascript
1
+ # es6-fuzz
2
+
3
+ > Fuzzy Logic in Javascript
2
4
 
3
5
  [![npm](https://img.shields.io/npm/dt/es6-fuzz.svg)](https://www.npmjs.com/package/es6-fuzz)
4
6
  [![license](https://img.shields.io/github/license/sebs/es6-fuzz.svg)](https://github.com/sebs/es6-fuzz/blob/master/LICENSE.md)
package/docs/CHANGELOG.md CHANGED
@@ -1,6 +1,41 @@
1
+ 2022-06-11
2
+ ==========
3
+
4
+ * 3.0.7
5
+ * fix: revert dep change
6
+ * refactor: make dependencies lighter
7
+ * (churn): changelog
8
+
9
+ 2022-06-02
10
+ ==========
11
+
12
+ * 3.0.6
13
+ * (churn): changelog
14
+ * feature: chehck if init was called before any logic os performed
15
+ * test: add another example to the tests
16
+ * chore: remove travis config
17
+ * chore: update dependencies
18
+
19
+ 2019-01-15
20
+ ==========
21
+
22
+ * (churn): changelog
23
+ * 3.0.5
24
+ * Updated docs gen
25
+
1
26
  2018-09-24
2
27
  ==========
3
28
 
29
+ * Badges
30
+ * Add text=auto
31
+ * docs
32
+ * Move badges to top
33
+ * Docs: Move icons behind the heading
34
+ * CI: Only node 9 and 10
35
+ * Add node6 to 10 to target
36
+ * Add Homepage
37
+ * fix list
38
+ * (churn): changelog
4
39
  * 3.0.4
5
40
  * remove package-lock before release
6
41
  * Update deps
@@ -109,55 +144,3 @@
109
144
  * Ghpages
110
145
  * 2.5.5
111
146
  * Autorelease
112
-
113
- 2017-01-27
114
- ==========
115
-
116
- * (churn): changelog
117
- * 2.5.4
118
- * Merge branch 'master' of github.com:sebs/es6-fuzz
119
- * Merge pull request [#64](https://github.com/sebs/es6-fuzz/issues/64) from sebs/greenkeeper-browserify-14.0.0
120
- Update browserify to version 14.0.0 🚀
121
-
122
- 2017-01-25
123
- ==========
124
-
125
- * chore(package): update browserify to version 14.0.0
126
- https://greenkeeper.io/
127
-
128
- 2017-01-09
129
- ==========
130
-
131
- * (churn): changelog
132
- * 2.5.3
133
- * Update deps
134
-
135
- 2016-10-14
136
- ==========
137
-
138
- * (churn): changelog
139
- * 2.5.2
140
- * Sigmoid as well
141
- * 2.5.1
142
- * Glossary
143
-
144
- 2016-10-05
145
- ==========
146
-
147
- * (churn): changelog
148
- * 2.5.0
149
- * (chrun): deps
150
-
151
- 2016-10-03
152
- ==========
153
-
154
- * (churn): changelog
155
- * 2.4.4
156
- * (docs): badges
157
-
158
- 2016-09-30
159
- ==========
160
-
161
- * (churn): test node 4-6
162
- * (churn): changelog
163
- * 2.4.3
package/lib/logic.js CHANGED
@@ -27,6 +27,7 @@ const ruleEngine = {
27
27
  /** Class helping with FuzzyLogic. */
28
28
 
29
29
  class Logic {
30
+ initCalled = false;
30
31
  constructor() {
31
32
  this.c = {
32
33
  Shape,
@@ -40,28 +41,39 @@ class Logic {
40
41
  };
41
42
  this.rules = [];
42
43
  }
44
+
45
+ checkInitCalled() {
46
+ if (!this.initCalled) {
47
+ throw Error('init needs to be called before performing logic');
48
+ }
49
+ }
50
+
43
51
  init(output, shape) {
52
+ this.initCalled = true;
44
53
  let type = TYPE_INIT;
45
54
  this.rules.push({ output, shape, type });
46
55
  return this;
47
56
  }
48
57
  and(output, shape) {
58
+ this.checkInitCalled();
49
59
  let type = TYPE_AND;
50
60
  this.rules.push({ output, shape, type });
51
61
  return this;
52
62
  }
53
63
  or(output, shape) {
64
+ this.checkInitCalled();
54
65
  let type = TYPE_OR;
55
66
  this.rules.push({ output, shape, type });
56
67
  return this;
57
68
  }
58
69
  not(output, shape) {
70
+ this.checkInitCalled();
59
71
  let type = TYPE_NOT;
60
72
  this.rules.push({ output, shape, type });
61
73
  return this;
62
74
  }
63
75
  defuzzify(value) {
64
-
76
+ this.checkInitCalled();
65
77
  let defuzzified = 'none';
66
78
  let fuzzified = 0;
67
79
  let lastShape;
package/package.json CHANGED
@@ -1,14 +1,13 @@
1
1
  {
2
2
  "name": "es6-fuzz",
3
3
  "description": "fuzzy logic with and for es6",
4
- "version": "3.0.4",
4
+ "version": "3.0.7",
5
5
  "main": "lib/logic.js",
6
6
  "repository": "git@github.com:sebs/es6-fuzz.git",
7
7
  "homepage": "https://github.com/sebs/es6-fuzz",
8
8
  "scripts": {
9
- "env": "env",
10
- "changelog": "rm ./docs/CHANGELOG.md && changelog https://github.com/sebs/es6-fuzz all > ./docs/CHANGELOG.md && git add . && git commit . -m '(churn): changelog'",
11
- "test": "mocha -r blanket",
9
+ "changelog": "rm ./docs/CHANGELOG.md && npx changelog https://github.com/sebs/es6-fuzz all > ./docs/CHANGELOG.md && git add . && git commit . -m '(churn): changelog'",
10
+ "test": "npx mocha",
12
11
  "test:watch": "npm test -- -w",
13
12
  "addpush": "git add . && git commit . -m 'docs'",
14
13
  "pages": "node ./scripts/publish-gh.js",
@@ -23,32 +22,14 @@
23
22
  "javascript",
24
23
  "es6"
25
24
  ],
26
- "config": {
27
- "blanket": {
28
- "pattern": "lib/*",
29
- "data-cover-never": [
30
- "node_modules",
31
- "tests"
32
- ]
33
- }
34
- },
35
25
  "author": "Sebastian Schürmann",
36
26
  "license": "MIT",
37
27
  "devDependencies": {
38
- "browserify": "^16.2.2",
39
- "changelog": "^1.0.7",
40
- "documentation": "^8.1.2",
41
- "es6ify": "^1.6.0",
42
- "eslint": "^5.6.0",
43
- "gh-pages": "^2.0.0",
44
- "ink-docstrap": "^1.3.0",
45
- "jscs": "^3.0.7",
46
- "jsdoc": "^3.4.3",
47
- "mocha": "^5.2.0",
48
- "mocha-traceur": "^2.1.0",
49
- "traceur": "0.0.111"
28
+ "gh-pages": "4.0.0",
29
+ "ink-docstrap": "1.3.2",
30
+ "jsdoc": "3.6.10"
50
31
  },
51
32
  "dependencies": {
52
- "blanket": "^1.2.3"
33
+ "boon-js": "2.0.3"
53
34
  }
54
35
  }
@@ -0,0 +1,25 @@
1
+ const assert = require('assert');
2
+ const Logic = require('../lib/logic');
3
+ const Triangle = require('../lib/curve/triangle');
4
+
5
+ describe('Example Test', function() {
6
+ var fuzzyvariable_pageSize;
7
+ beforeEach(()=>{
8
+ const logic = new Logic();
9
+ fuzzyvariable_pageSize = logic
10
+ .init('Excellent', new Triangle(20, 40, 60))
11
+ .or('Medium', new Triangle(40,60,80))
12
+ .or('Bad', new Triangle(60,80,100))
13
+
14
+ })
15
+
16
+ it('40 is excellent', ()=>{
17
+ assert.equal(fuzzyvariable_pageSize.defuzzify(40).defuzzified, 'Excellent');
18
+ })
19
+ it('60 is medium', ()=>{
20
+ assert.equal(fuzzyvariable_pageSize.defuzzify(60).defuzzified, 'Medium');
21
+ })
22
+ it('80 is bad', ()=>{
23
+ assert.equal(fuzzyvariable_pageSize.defuzzify(80).defuzzified, 'Bad');
24
+ });
25
+ });
@@ -0,0 +1,16 @@
1
+ const assert = require('assert');
2
+ const Logic = require('../lib/logic');
3
+ const Triangle = require('../lib/curve/triangle');
4
+
5
+ describe('Example Test', function() {
6
+
7
+ it('init needs to be called before using logic', ()=>{
8
+
9
+ assert.throws(()=>{
10
+ const logic = new Logic();
11
+ fuzzyvariable_pageSize = logic
12
+ .or('Excellent', new Triangle(20, 40, 60))
13
+ });
14
+ });
15
+
16
+ });
package/.travis.yml DELETED
@@ -1,12 +0,0 @@
1
- language: node_js
2
- node_js:
3
- - '6'
4
- - '7'
5
- deploy:
6
- provider: npm
7
- email: sebs@2xs.org
8
- api_key:
9
- secure: T35SMb9f2nbwvl1yviqoofkaAon01DmgSoV4Stf0ZNb1FVdpEAv7yAhWJ4NJAueg9cY+WF+M1n3i/3dy3+v5xAC3Vd1gNfuRAWjCTf7eEbhmRPoSBXeOBSFR3I3MTMN6L2iiRTv9TIqhLMBRydJ4dVeYlvFDybTlM3lfEXzfQ60bbZ3xppv9rjDj7qg0SAi3ro1Xf7aCZ9fnlsZDj5nA5KtHdFrdvp+YV/H62z6g+L/wWpFgipfIL6ZXDgBuMF3rA4XzlyiKW4FcNC9nfRGdMpJeoiqsmubOL40E64RrZnXbU8FkEQkX+taRoyWipTvENvPxDWBlRABxp6h/2qElRtKLaaGbJzzZqu8FoSauLX93rusaTAlwjtEIjZuxlZkKiGAiB/Otl9R6AS1QUBxlZckGum4z/VHGhZyCBhtIqlC2X3+1d//ooGjoDt/r+/cfL/hiChGsyV14ftOf/KEvtX25vTUOYgcoBezLNJG0TI/KEyxeEQGxDhM2BBmMydwGs2k54fZ2BS5w2r7Ue04JTcFcChXfQ590rHFMRx/HSD8Axk/zhir4lgGU/Umr9erbeTr1UaUvjYR8TgPgIeEnMQQOvqXMd7wvrajrfjMlKGxhqAPumtMVcB4S+QznVBqZkuRbszflwU+J1OT4GAgvsV2xhd77Nz19VrQWo+JE0mk=
10
- on:
11
- tags: true
12
- repo: sebs/es6-fuzz