You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The `af-conditionals` library was created to provide a consistent interface from which to create dynamic comparisons, conditional expressions, logical expressions, and operations. Through the interface, expressions can be defined externally to the application code and dynamically executed.
10
10
11
11
## Standard Calling Conventions
12
12
13
-
All Comparisons, Conditionals, Logicals, and Operators expose the object class and a variable named after the class with the word *Instance* appended, but starting with a lowercase letter. For example: `IsString` is exposed as is `isStringInstance`. The `isStringInstance` variable is declared with a `let` so you may subclass the object and then use your version of your class throughout your application easily. Additionally, we expose a function that implements the testing for the class, for example, `IsString` has a exposed function `isString` that calls `isStringInstance.test()`. *(This is described in the Release Notes for v0.2.0.)*
13
+
All Comparisons, Conditionals, Logicals, and Operators expose the object class and a variable named after the class with the word _Instance_ appended, but starting with a lowercase letter. For example: `IsString` is exposed as is `isStringInstance`. The `isStringInstance` variable is declared with a `let` so you may subclass the object and then use your version of your class throughout your application easily. Additionally, we expose a function that implements the testing for the class, for example, `IsString` has a exposed function `isString` that calls `isStringInstance.test()`. _(This is described in the Release Notes for v0.2.0.)_
14
14
15
15
## Release Notes
16
16
@@ -26,15 +26,15 @@ In v0.1.0, you would write code like this:
26
26
27
27
```javascript
28
28
if (isUsable.test(someVar)) {
29
-
console.log("It is usable");
29
+
console.log('It is usable');
30
30
}
31
31
```
32
32
33
33
Starting in v0.2.0, you can now simply say:
34
34
35
35
```javascript
36
36
if (isUsable(someVar)) {
37
-
console.log("It is usable");
37
+
console.log('It is usable');
38
38
}
39
39
```
40
40
@@ -55,6 +55,13 @@ if (isUsable(someVar)) {
55
55
56
56
- Official 1.0.0 release version
57
57
58
+
### v1.1.0
59
+
60
+
- Updated dependencies
61
+
- Updated package.json for consistent scripts across af-XXXX libraries
62
+
- removed .vscode folder
63
+
- Updated README.md
64
+
58
65
## Comparisons
59
66
60
67
The `Comparison` class provides a `compare` and `test` public methods.
@@ -65,13 +72,13 @@ The `compare` method takes two values and compares them returning:
65
72
- 0 (zero) when the first value is equal to the second value
66
73
- +1 (postive numeral one) when the first value is greater than the second value
67
74
68
-
The `test` uses the `compare` method to get the result and then compare that result to an expected result that you supply. Compare returns:
75
+
_When possible the `compare` method will compare the values using strict equals (`===`). When the values are not of the same type, `compare` will use coerced equality (`==`)._
76
+
77
+
The `test` uses the `compare` method to get the result and then compare that result to an expected result that you supply. `test` returns:
69
78
70
79
-`true` if the returned result and expected result are equal
71
80
-`false` otherwise
72
81
73
-
*When possible the `compare` method will compare the values using strict equals (`===`). When the values are not of the same type, `compare` will use coerced equality (`==`).*
74
-
75
82
Supplied Comparisons are:
76
83
77
84
-`Equal` - determines if two values are equal
@@ -80,7 +87,7 @@ Supplied Comparisons are:
80
87
-`LessThan` - determines if the first value is less than the second value
81
88
-`LessThanOrEqual` - determines if the first value is less than or equal to the second value
82
89
83
-
*Comparisons use shorthand calling function names instead of exposed functions of `equal`, `greaterThan`, etc... `eq`, `gt`, `gte`, `lt`, `lte` are exposed.*
90
+
_Comparisons use shorthand calling function names instead of exposed functions of `equal`, `greaterThan`, etc... `eq`, `gt`, `gte`, `lt`, `lte` are exposed._
0 commit comments