Merge remote-tracking branch 'megawac/526-reduce' into megawac-526-reduce

This commit is contained in:
Jürg Lehni 2016-01-10 18:06:11 +01:00
commit 7b29bb177d
2 changed files with 28 additions and 0 deletions

View file

@ -864,6 +864,13 @@ var Point = Base.extend(/** @lends Point# */{
* var point2 = new Point(200, 5);
* var minPoint = Point.min(point1, point2);
* console.log(minPoint); // {x: 10, y: 5}
*
* @example
* // Solving with multiple points
* var point1 = new Point(60, 100);
* var point2 = new Point(200, 5);
* var point3 = new Point(250, 35);
* [point1, point2, point3].reduce(Point.min) // => Point {x: 60, y: 5}
*/
min: function(/* point1, point2 */) {
var point1 = Point.read(arguments),
@ -888,6 +895,13 @@ var Point = Base.extend(/** @lends Point# */{
* var point2 = new Point(200, 5);
* var maxPoint = Point.max(point1, point2);
* console.log(maxPoint); // {x: 200, y: 100}
*
* @example
* // Solving with multiple points
* var point1 = new Point(60, 100);
* var point2 = new Point(200, 5);
* var point3 = new Point(250, 35);
* [point1, point2, point3].reduce(Point.max) // => Point {x: 250, y: 100}
*/
max: function(/* point1, point2 */) {
var point1 = Point.read(arguments),

View file

@ -466,6 +466,13 @@ var Size = Base.extend(/** @lends Size# */{
* var size2 = new Size(200, 5);
* var minSize = Size.min(size1, size2);
* console.log(minSize); // {width: 10, height: 5}
*
* @example
* // Solving with multiple sizes
* var size1 = new Size(60, 100);
* var size2 = new Size(200, 5);
* var size3 = new Size(250, 35);
* [size1, size2, size3].reduce(Size.min) // => Size {width: 60, height: 5}
*/
min: function(size1, size2) {
return new Size(
@ -487,6 +494,13 @@ var Size = Base.extend(/** @lends Size# */{
* var size2 = new Size(200, 5);
* var maxSize = Size.max(size1, size2);
* console.log(maxSize); // {width: 200, height: 100}
*
* @example
* // Solving with multiple sizes
* var size1 = new Size(60, 100);
* var size2 = new Size(200, 5);
* var size3 = new Size(250, 35);
* [size1, size2, size3].reduce(Size.max) // => Size {width: 250, height: 100}
*/
max: function(size1, size2) {
return new Size(