Browse Source

[readme] updated

Exilon 4 years ago
parent
commit
9e37b74da5
1 changed files with 31 additions and 0 deletions
  1. 31 0
      README.md

+ 31 - 0
README.md

@@ -60,10 +60,12 @@ Small delphi/Firemonkey(Windows, Linux, Android, OSX & IOS) and fpc(Windows & Li
 * **Quick.Parameters:** Work with commandline parameters like a class.
 * **Quick.Url.Utils:** Simple url manipulation
 * **Quick.RegEx.Utils:** Commonly used RegEx comparison (email verification, password complexity, etc)
+* **Quick.Conditions:** Pre and postcondition validations in fluent style.
 
 
 **Updates:**
 
+* NEW: Condition checks
 * NEW: Commonly used RegEx validations
 * NEW: Url manipulation utils
 * NEW: QuickParameters to work with commandline arguments like a class.
@@ -1358,4 +1360,33 @@ Arguments:
 - **RemoveQuery:** Remove query part from an url.
 - **EncodeUrl:** Encode path and query from and url.
 
+**Quick.RegEx.Utils:**
+--
+Commonly used validations.
+```delphi
+```
+
+**Quick.Conditions:**
+--
+Pre and postcondition validations in fluent style.
+Condition.Requires evaluates a variable for conditions before do some operations.
+Condition.Ensures evaluates a variable result for conditions after do some operations.
+```delphi
+    Condition.Requires(num, "num")
+        .IsInRange(1,10,'value for num is out of range');   // throws custom error if not in range
+        .IsNotGreater(50);   // throws ArgumentException if not equal to 128
+
+    Condition.Requires(myobj, "myobj")
+        .WithExceptionOnFailure(EMyException) //throws specific exception on failure
+        .IsNotNull()          // throws ArgumentNullException if null
+        .Evaluate(myobj.id > 10); // myobj.id must be greater than 10
+
+    Condition.Requires(text, "text")
+        .IsNotEmpty()          // throws ArgumentNullException if empty
+        .StartsWith("<html>") // throws ArgumentException if not starts with <html>
+        .EndsWith("</html>") // throws ArgumentException if not ends with </html>
+        .IsNotLowerCase // thows ArgumentException if not lowercase
+        .Evaluate(text.Contains("sometxt") or test.Contains('othertxt')); // throws ArgumentException if not evaluates
+```
+
 >Do you want to learn delphi or improve your skills? [learndelphi.org](https://learndelphi.org)