Skip to content

Commit

Permalink
README update + version bump.
Browse files Browse the repository at this point in the history
  • Loading branch information
jwaliszko committed May 3, 2016
1 parent 5e81ae4 commit a764aa4
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 11 deletions.
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,8 @@ Toolchain functions available out of the box at server- and client-side:
* Initializes a new date to a specified year, month (months are 1-based), and day, with the time component set to 00:00:00 (client-side returns the number of milliseconds since January 1, 1970, 00:00:00 UTC).
* `DateTime Date(int year, int month, int day, int hour, int minute, int second)`
* Initializes a new date to a specified year, month (months are 1-based), day, hour, minute, and second (client-side returns the number of milliseconds since January 1, 1970, 00:00:00 UTC).
* `DateTime ToDate(string dateString)`
* Converts the specified string representation of a date and time to its equivalents: `DateTime` at server-side - uses .NET [`DateTime.Parse(string dateString)`](https://msdn.microsoft.com/en-us/library/vstudio/1k1skd40(v=vs.100).aspx), and number of milliseconds since January 1, 1970, 00:00:00 UTC at client-side - uses JavaScript [`Date.parse(dateString)`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/parse).
* `TimeSpan TimeSpan(int days, int hours, int minutes, int seconds)`
* Initializes a new time period according to specified days, hours, minutes, and seconds (client-side period is expressed in milliseconds).
* `int Length(str)`
Expand Down Expand Up @@ -362,6 +364,14 @@ Toolchain functions available out of the box at server- and client-side:
* Indicates whether the regular expression finds a match in the input string (null-safe).
* `Guid Guid(string str)`
* Initializes a new instance of the Guid structure by using the value represented by a specified string.
* `double Min(params double[] values)`
* Returns the minimum value in a sequence of numeric values.
* `double Max(params double[] values)`
* Returns the maximum value in a sequence of numeric values.
* `double Sum(params double[] values)`
* Computes the sum of the numeric values in a sequence.
* `double Average(params double[] values)`
* Computes the average of the numeric values in a sequence.

###<a id="how-to-construct-conditional-validation-attributes">How to construct conditional validation attributes?</a>

Expand Down
Binary file modified doc/api/api.chm
Binary file not shown.
4 changes: 2 additions & 2 deletions src/ExpressiveAnnotations.Tests/ParserTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -896,8 +896,8 @@ public void verify_toolchain_methods_logic()

var arrModel = new
{
SingleElementArray = new[] {1},
MultipleElementsArray = new[] {1, 2, 3}
SingleElementArray = new[] {1.0},
MultipleElementsArray = new[] {1.0, 2, 3}
};

Assert.True(parser.Parse(arrModel.GetType(), "Min(SingleElementArray) == 1").Invoke(arrModel));
Expand Down
4 changes: 2 additions & 2 deletions src/ExpressiveAnnotations/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,5 +42,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.4.1.0")]
[assembly: AssemblyFileVersion("2.4.1.0")]
[assembly: AssemblyVersion("2.5.0.0")]
[assembly: AssemblyFileVersion("2.5.0.0")]
8 changes: 4 additions & 4 deletions src/ExpressiveAnnotations/Toolchain.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,10 @@ private Toolchain()
AddFunction<string, bool>("IsUrl", str => str != null && Regex.IsMatch(str, @"^(?:(?:https?|ftp):\/\/)(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z\u00a1-\uffff0-9]-*)*[a-z\u00a1-\uffff0-9]+)(?:\.(?:[a-z\u00a1-\uffff0-9]-*)*[a-z\u00a1-\uffff0-9]+)*(?:\.(?:[a-z\u00a1-\uffff]{2,})))(?::\d{2,5})?(?:\/\S*)?$", RegexOptions.IgnoreCase)); // contributed by Diego Perini: https://gist.github.com/dperini/729294 (https://mathiasbynens.be/demo/url-regex)
AddFunction<string, string, bool>("IsRegexMatch", (str, regex) => str != null && regex != null && Regex.IsMatch(str, regex));
AddFunction<string, Guid>("Guid", str => new Guid(str));
AddFunction("Min", (Expression<ParamsDelegate<int, int>>)(items => items.Min()));
AddFunction("Max", (Expression<ParamsDelegate<int, int>>)(items => items.Max()));
AddFunction("Sum", (Expression<ParamsDelegate<int, int>>)(items => items.Sum()));
AddFunction("Average", (Expression<ParamsDelegate<int, double>>)(items => items.Average()));
AddFunction("Min", (Expression<ParamsDelegate<double, double>>)(items => items.Min()));
AddFunction("Max", (Expression<ParamsDelegate<double, double>>)(items => items.Max()));
AddFunction("Sum", (Expression<ParamsDelegate<double, double>>)(items => items.Sum()));
AddFunction("Average", (Expression<ParamsDelegate<double, double>>)(items => items.Average()));
}

/// <summary>
Expand Down
2 changes: 1 addition & 1 deletion src/expressive.annotations.validate.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* expressive.annotations.validate.js - v2.6.6
/* expressive.annotations.validate.js - v2.6.7
* Client-side component of ExpresiveAnnotations - annotation-based conditional validation library.
* https://github.com/jwaliszko/ExpressiveAnnotations
*
Expand Down
4 changes: 2 additions & 2 deletions src/expressive.annotations.validate.min.js

Large diffs are not rendered by default.

0 comments on commit a764aa4

Please sign in to comment.