From 4d641fe5ffb4efbb4281a53868bb23698abeb0ab Mon Sep 17 00:00:00 2001 From: Graeme Date: Sun, 14 Dec 2014 13:07:43 -0500 Subject: [PATCH] Examples to resolve #526 --- src/basic/Point.js | 14 ++++++++++++++ src/basic/Size.js | 14 ++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/src/basic/Point.js b/src/basic/Point.js index f86910db..c481abd9 100644 --- a/src/basic/Point.js +++ b/src/basic/Point.js @@ -862,6 +862,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), @@ -886,6 +893,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), diff --git a/src/basic/Size.js b/src/basic/Size.js index 8fd10889..64732e94 100644 --- a/src/basic/Size.js +++ b/src/basic/Size.js @@ -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(