Skip to content

Commit

Permalink
updated dependencies and fixed build under node 6.4
Browse files Browse the repository at this point in the history
  • Loading branch information
konsultaner committed Jun 28, 2016
1 parent 461a436 commit 26ab08c
Show file tree
Hide file tree
Showing 9 changed files with 52 additions and 12 deletions.
11 changes: 9 additions & 2 deletions bin/json.odm.js
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -1539,6 +1539,7 @@ jsonOdm.Geo.edgeIntersectsBounds = function (edge, bounds) {
}; };


/** /**
* TODO: ALSO needs to return true for [[1,1],[2,2,]] and [[0,0],[4,4]] // probably needs a rewrite
* Checks whether a line follows another line or is on the line respectively * Checks whether a line follows another line or is on the line respectively
* @param {Array} lineString An array of points, i.e. [[1,1],[1,2],[1,3]] * @param {Array} lineString An array of points, i.e. [[1,1],[1,2],[1,3]]
* @param {Array} inLineString An array of points, i.e. [[1,1],[1,2],[1,3]] * @param {Array} inLineString An array of points, i.e. [[1,1],[1,2],[1,3]]
Expand All @@ -1561,9 +1562,9 @@ jsonOdm.Geo.lineStringWithinLineString = function (lineString, inLineString) {
!( !(
// next is not the next one // next is not the next one
(inLineString[j + 1] && lineString[i + 1][0] === inLineString[j + 1][0] && lineString[i + 1][1] === inLineString[j + 1][1]) || (inLineString[j + 1] && lineString[i + 1][0] === inLineString[j + 1][0] && lineString[i + 1][1] === inLineString[j + 1][1]) ||
// next is not the same one // next is not the same one
(lineString[i + 1][0] === inLineString[j][0] && lineString[i + 1][1] === inLineString[j][1]) || (lineString[i + 1][0] === inLineString[j][0] && lineString[i + 1][1] === inLineString[j][1]) ||
// next is not the previous one // next is not the previous one
(j > 0 && lineString[i + 1][0] === inLineString[j - 1][0] && lineString[i + 1][1] === inLineString[j - 1][1]) (j > 0 && lineString[i + 1][0] === inLineString[j - 1][0] && lineString[i + 1][1] === inLineString[j - 1][1])
) )
) { ) {
Expand Down Expand Up @@ -1619,6 +1620,7 @@ jsonOdm.Collection.decorate = function (collection) {
var decorate = function (collection) { var decorate = function (collection) {
if (jsonOdm.util.isArray(collection)) { if (jsonOdm.util.isArray(collection)) {
/** /**
* // TODO needs a proper has many functionality that aromatically gathers the child elements
* Creates a has many relation to another collection * Creates a has many relation to another collection
* @param {Array|String} foreignKeyMapName The name of the field that holds an array of foreign keys * @param {Array|String} foreignKeyMapName The name of the field that holds an array of foreign keys
* @param {int|String} privateKeyField The private key of the foreign collection objects * @param {int|String} privateKeyField The private key of the foreign collection objects
Expand Down Expand Up @@ -1669,6 +1671,11 @@ jsonOdm.Collection.decorate = function (collection) {
* @param {String} alias The new field that will carry the connected data. * @param {String} alias The new field that will carry the connected data.
* @memberof jsonOdm.Collection.prototype * @memberof jsonOdm.Collection.prototype
* @method $hasOne * @method $hasOne
* @example
* var customers = new jsonOdm.Collection("customers");
* customers.$hasOne("id","customerGroupId","customerGroup","group");
* console.log(customers[0]);
* // > {name:"Some Name",age:"25",...,customerGroupId:1,gourp:{id:1,name:"VIP"},...}
*/ */
collection.$hasOne = function (foreignKey, privateKeyField, childCollectionName, alias) { collection.$hasOne = function (foreignKey, privateKeyField, childCollectionName, alias) {
// SET THE ALIAS // SET THE ALIAS
Expand Down
4 changes: 2 additions & 2 deletions bin/json.odm.min.js

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions doc/jsonOdm/0.2/collection.js.html
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -977,6 +977,7 @@ <h3>Modules</h3>
var decorate = function (collection) { var decorate = function (collection) {
if (jsonOdm.util.isArray(collection)) { if (jsonOdm.util.isArray(collection)) {
/** /**
* // TODO needs a proper has many functionality that aromatically gathers the child elements
* Creates a has many relation to another collection * Creates a has many relation to another collection
* @param {Array|String} foreignKeyMapName The name of the field that holds an array of foreign keys * @param {Array|String} foreignKeyMapName The name of the field that holds an array of foreign keys
* @param {int|String} privateKeyField The private key of the foreign collection objects * @param {int|String} privateKeyField The private key of the foreign collection objects
Expand Down Expand Up @@ -1027,6 +1028,11 @@ <h3>Modules</h3>
* @param {String} alias The new field that will carry the connected data. * @param {String} alias The new field that will carry the connected data.
* @memberof jsonOdm.Collection.prototype * @memberof jsonOdm.Collection.prototype
* @method $hasOne * @method $hasOne
* @example
* var customers = new jsonOdm.Collection("customers");
* customers.$hasOne("id","customerGroupId","customerGroup","group");
* console.log(customers[0]);
* // > {name:"Some Name",age:"25",...,customerGroupId:1,gourp:{id:1,name:"VIP"},...}
*/ */
collection.$hasOne = function (foreignKey, privateKeyField, childCollectionName, alias) { collection.$hasOne = function (foreignKey, privateKeyField, childCollectionName, alias) {
// SET THE ALIAS // SET THE ALIAS
Expand Down
5 changes: 3 additions & 2 deletions doc/jsonOdm/0.2/geo.js.html
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -2229,6 +2229,7 @@ <h3>Modules</h3>
}; };


/** /**
* TODO: ALSO needs to return true for [[1,1],[2,2,]] and [[0,0],[4,4]] // probably needs a rewrite
* Checks whether a line follows another line or is on the line respectively * Checks whether a line follows another line or is on the line respectively
* @param {Array} lineString An array of points, i.e. [[1,1],[1,2],[1,3]] * @param {Array} lineString An array of points, i.e. [[1,1],[1,2],[1,3]]
* @param {Array} inLineString An array of points, i.e. [[1,1],[1,2],[1,3]] * @param {Array} inLineString An array of points, i.e. [[1,1],[1,2],[1,3]]
Expand All @@ -2251,9 +2252,9 @@ <h3>Modules</h3>
!( !(
// next is not the next one // next is not the next one
(inLineString[j + 1] &amp;&amp; lineString[i + 1][0] === inLineString[j + 1][0] &amp;&amp; lineString[i + 1][1] === inLineString[j + 1][1]) || (inLineString[j + 1] &amp;&amp; lineString[i + 1][0] === inLineString[j + 1][0] &amp;&amp; lineString[i + 1][1] === inLineString[j + 1][1]) ||
// next is not the same one // next is not the same one
(lineString[i + 1][0] === inLineString[j][0] &amp;&amp; lineString[i + 1][1] === inLineString[j][1]) || (lineString[i + 1][0] === inLineString[j][0] &amp;&amp; lineString[i + 1][1] === inLineString[j][1]) ||
// next is not the previous one // next is not the previous one
(j > 0 &amp;&amp; lineString[i + 1][0] === inLineString[j - 1][0] &amp;&amp; lineString[i + 1][1] === inLineString[j - 1][1]) (j > 0 &amp;&amp; lineString[i + 1][0] === inLineString[j - 1][0] &amp;&amp; lineString[i + 1][1] === inLineString[j - 1][1])
) )
) { ) {
Expand Down
14 changes: 12 additions & 2 deletions doc/jsonOdm/0.2/jsonOdm.Collection.html
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -1224,7 +1224,8 @@ <h3 class="subsection-title">
</td> </td>
<td class="description"> <td class="description">


Creates a has many relation to another collection // TODO needs a proper has many functionality that aromatically gathers the child elements
Creates a has many relation to another collection






Expand Down Expand Up @@ -1475,7 +1476,8 @@ <h4>Parameters</h4>


<div class="description"> <div class="description">
<p> <p>
Creates a has many relation to another collection // TODO needs a proper has many functionality that aromatically gathers the child elements
Creates a has many relation to another collection
</p> </p>
</div> </div>


Expand Down Expand Up @@ -1878,6 +1880,14 @@ <h4>Parameters</h4>






<h4>Example</h4>

<pre class="prettyprint"><code>var customers = new jsonOdm.Collection("customers");
customers.$hasOne("id","customerGroupId","customerGroup","group");
console.log(customers[0]);
// > {name:"Some Name",age:"25",...,customerGroupId:1,gourp:{id:1,name:"VIP"},...}</code></pre>






</dd> </dd>
Expand Down
6 changes: 4 additions & 2 deletions doc/jsonOdm/0.2/jsonOdm.Geo.html
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -1270,7 +1270,8 @@ <h3 class="subsection-title">
</td> </td>
<td class="description"> <td class="description">


Checks whether a line follows another line or is on the line respectively TODO: ALSO needs to return true for [[1,1],[2,2,]] and [[0,0],[4,4]] // probably needs a rewrite
Checks whether a line follows another line or is on the line respectively






Expand Down Expand Up @@ -3455,7 +3456,8 @@ <h4>Example</h4>


<div class="description"> <div class="description">
<p> <p>
Checks whether a line follows another line or is on the line respectively TODO: ALSO needs to return true for [[1,1],[2,2,]] and [[0,0],[4,4]] // probably needs a rewrite
Checks whether a line follows another line or is on the line respectively
</p> </p>
</div> </div>


Expand Down
6 changes: 6 additions & 0 deletions src/collection.js
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ jsonOdm.Collection.decorate = function (collection) {
var decorate = function (collection) { var decorate = function (collection) {
if (jsonOdm.util.isArray(collection)) { if (jsonOdm.util.isArray(collection)) {
/** /**
* // TODO needs a proper has many functionality that aromatically gathers the child elements
* Creates a has many relation to another collection * Creates a has many relation to another collection
* @param {Array|String} foreignKeyMapName The name of the field that holds an array of foreign keys * @param {Array|String} foreignKeyMapName The name of the field that holds an array of foreign keys
* @param {int|String} privateKeyField The private key of the foreign collection objects * @param {int|String} privateKeyField The private key of the foreign collection objects
Expand Down Expand Up @@ -89,6 +90,11 @@ jsonOdm.Collection.decorate = function (collection) {
* @param {String} alias The new field that will carry the connected data. * @param {String} alias The new field that will carry the connected data.
* @memberof jsonOdm.Collection.prototype * @memberof jsonOdm.Collection.prototype
* @method $hasOne * @method $hasOne
* @example
* var customers = new jsonOdm.Collection("customers");
* customers.$hasOne("id","customerGroupId","customerGroup","group");
* console.log(customers[0]);
* // > {name:"Some Name",age:"25",...,customerGroupId:1,gourp:{id:1,name:"VIP"},...}
*/ */
collection.$hasOne = function (foreignKey, privateKeyField, childCollectionName, alias) { collection.$hasOne = function (foreignKey, privateKeyField, childCollectionName, alias) {
// SET THE ALIAS // SET THE ALIAS
Expand Down
5 changes: 3 additions & 2 deletions src/geo.js
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -1291,6 +1291,7 @@ jsonOdm.Geo.edgeIntersectsBounds = function (edge, bounds) {
}; };


/** /**
* TODO: ALSO needs to return true for [[1,1],[2,2,]] and [[0,0],[4,4]] // probably needs a rewrite
* Checks whether a line follows another line or is on the line respectively * Checks whether a line follows another line or is on the line respectively
* @param {Array} lineString An array of points, i.e. [[1,1],[1,2],[1,3]] * @param {Array} lineString An array of points, i.e. [[1,1],[1,2],[1,3]]
* @param {Array} inLineString An array of points, i.e. [[1,1],[1,2],[1,3]] * @param {Array} inLineString An array of points, i.e. [[1,1],[1,2],[1,3]]
Expand All @@ -1313,9 +1314,9 @@ jsonOdm.Geo.lineStringWithinLineString = function (lineString, inLineString) {
!( !(
// next is not the next one // next is not the next one
(inLineString[j + 1] && lineString[i + 1][0] === inLineString[j + 1][0] && lineString[i + 1][1] === inLineString[j + 1][1]) || (inLineString[j + 1] && lineString[i + 1][0] === inLineString[j + 1][0] && lineString[i + 1][1] === inLineString[j + 1][1]) ||
// next is not the same one // next is not the same one
(lineString[i + 1][0] === inLineString[j][0] && lineString[i + 1][1] === inLineString[j][1]) || (lineString[i + 1][0] === inLineString[j][0] && lineString[i + 1][1] === inLineString[j][1]) ||
// next is not the previous one // next is not the previous one
(j > 0 && lineString[i + 1][0] === inLineString[j - 1][0] && lineString[i + 1][1] === inLineString[j - 1][1]) (j > 0 && lineString[i + 1][0] === inLineString[j - 1][0] && lineString[i + 1][1] === inLineString[j - 1][1])
) )
) { ) {
Expand Down
7 changes: 7 additions & 0 deletions test/geo.js
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -75,6 +75,13 @@ describe("Geo Tools", function () {
expect(jsonOdm.Geo.edgeWithinPolygon([[2,5],[10,6]],[[0,0],[10,0],[10,10],[6,10],[6,4],[5,10],[0,10]])).toBeFalsy(); expect(jsonOdm.Geo.edgeWithinPolygon([[2,5],[10,6]],[[0,0],[10,0],[10,10],[6,10],[6,4],[5,10],[0,10]])).toBeFalsy();
}); });
}); });
describe("LineString within LineString", function () {
it("Sould only take arrays", function () {
expect(jsonOdm.Geo.lineStringWithinLineString([[1,2],[3,2]],[[0,0],[1,2],[3,2],[4,4]])).toBeTruthy();
expect(jsonOdm.Geo.lineStringWithinLineString([[1,1],[2,2]],[[0,0],[1,1]])).toBeFalsy();
expect(jsonOdm.Geo.lineStringWithinLineString()).toBeFalsy();
})
});
describe("Point on LineString", function () { describe("Point on LineString", function () {
var point = [10,10]; var point = [10,10];
var line1 = [[0,0],[0,10],[10,10],[10,0]]; var line1 = [[0,0],[0,10],[10,10],[10,0]];
Expand Down

0 comments on commit 26ab08c

Please sign in to comment.