Skip to content

Commit

Permalink
Quick example
Browse files Browse the repository at this point in the history
  • Loading branch information
tmcw committed Mar 15, 2015
1 parent bdb028f commit 584d0f1
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@ modification methods.
| `y` | Number | the y-coordinate. this could be latitude or screen pixels, or any other sort of unit. |


### Example

```js
var point = new Point(-77, 38);
```


### `clone`

Expand Down Expand Up @@ -280,6 +286,15 @@ is already a Point, or an unknown type, return it unchanged
| `a` | Array\.\<Number\>\,Point | any kind of input value |


### Example

```js
// this
var point = Point.convert([0, 1]);
// is equivalent to
var point = new Point(0, 1);
```


**Returns** `Point`, constructed point, or passed-through value.

Expand Down
7 changes: 7 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ module.exports = Point;
* pixels, or any other sort of unit.
* @param {Number} y the y-coordinate. this could be latitude or screen
* pixels, or any other sort of unit.
* @example
* var point = new Point(-77, 38);
*/
function Point(x, y) {
this.x = x;
Expand Down Expand Up @@ -246,6 +248,11 @@ Point.prototype = {
* is already a Point, or an unknown type, return it unchanged
* @param {Array<Number>|Point|*} a any kind of input value
* @return {Point} constructed point, or passed-through value.
* @example
* // this
* var point = Point.convert([0, 1]);
* // is equivalent to
* var point = new Point(0, 1);
*/
Point.convert = function (a) {
if (a instanceof Point) {
Expand Down

0 comments on commit 584d0f1

Please sign in to comment.