Socket
Socket
Sign inDemoInstall

json-odm

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

json-odm - npm Package Compare versions

Comparing version 0.2.1 to 0.2.2

docs/coverage/lcov/lcov.info

4

bin/json.odm.min.js

@@ -1,2 +0,2 @@

"use strict";function JsonOdm(){var t=this;this.sources={},this.selectedSource={},this.addSource=function(e,n,o){"object"==typeof n&&("undefined"==typeof t.sources[e]&&(t.sources[e]=n),o&&(t.selectedSource=n))},this.selectSource=function(e){"undefined"!=typeof t.sources[e]&&(t.selectedSource=t.sources[e])}}function createQueryStringModifier(t){return function(){return this.$modifyField(function(t,e){return function(n){return"string"==typeof n&&String.prototype.hasOwnProperty(e)?String.prototype[e].apply(n,t):n}}(arguments,t))}}var root="undefined"!=typeof window?window:global,jsonOdm=new JsonOdm;if(root.jsonOdm||(root.jsonOdm=jsonOdm),"undefined"!=typeof module&&module.exports&&(module.exports=jsonOdm),"undefined"==typeof jsonOdm)var jsonOdm=new JsonOdm;if(jsonOdm.Util=function(){},jsonOdm.Util.prototype.isArray=function(t){return Array.isArray?Array.isArray(t):"[object Array]"===Object.prototype.toString.call(t)},jsonOdm.Util.prototype.is=function(t,e){e="string"==typeof e?[e]:e;var n=Object.prototype.toString.call(t);n=n.substring(8,n.length-1).toLowerCase();for(var o=0;o<e.length;o++){var r=e[o].toLowerCase();if("array"==r&&this.isArray(t))return!0;if(r===n)return!0;if(typeof t===r)return!0}return!1},jsonOdm.Util.prototype.objectKeys=Object.keys||function(){var t=Object.prototype.hasOwnProperty,e=!{toString:null}.propertyIsEnumerable("toString"),n=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],o=n.length;return function(r){if("object"!=typeof r&&("function"!=typeof r||null===r))throw new TypeError("Object.keys called on non-object");var i,s,u=[];for(i in r)t.call(r,i)&&u.push(i);if(e)for(s=0;o>s;s++)t.call(r,n[s])&&u.push(n[s]);return u}}(),jsonOdm.Util.prototype.branch=function(t,e){function n(){if(arguments&&arguments.length&&this){var t=this[arguments[0]];return t?n.apply(t,Array.prototype.slice.call(arguments,1)):t}return this}return n.apply(t,e)},jsonOdm.Util.prototype.projectElement=function(t,e,n){var o={};for(var r in t)t.hasOwnProperty(r)&&(1==t[r]?o[r]=e[r]:"function"==typeof t[r]?o[r]=t[r](n||e):t[r]instanceof jsonOdm.Query?(o[r]=t[r].$$commandQueue[t[r].$$commandQueue.length-1](e),t[r].$$accumulation!==!1&&(o[r]=t[r].$$accumulation)):"object"==typeof t[r]&&(o[r]=this.projectElement(t[r],e[r],n||e)));return o},jsonOdm.util=new jsonOdm.Util,"undefined"==typeof jsonOdm)var jsonOdm=new JsonOdm;if(jsonOdm.Geo=function(){},jsonOdm.Geo.detectAsGeometry=function(t){if(!t.type)if(jsonOdm.util.isArray(t)&&2===t.length&&!jsonOdm.util.isArray(t[0]))t=new jsonOdm.Geo.Point(t);else if(jsonOdm.util.isArray(t)&&4===t.length&&!jsonOdm.util.isArray(t[0]))t=new jsonOdm.Geo.BoundaryBox(t);else if(jsonOdm.util.isArray(t)&&t.length>=1&&jsonOdm.util.isArray(t[0])&&2===t[0].length&&!jsonOdm.util.isArray(t[0][0]))t=new jsonOdm.Geo.LineString(t);else if(jsonOdm.util.isArray(t)&&t.length>=1&&jsonOdm.util.isArray(t[0])&&t[0].length>=1&&jsonOdm.util.isArray(t[0][0])&&2===t[0][0].length&&!jsonOdm.util.isArray(t[0][0][0]))t=new jsonOdm.Geo.Polygon(t);else{if(!(jsonOdm.util.isArray(t)&&t.length>=1&&jsonOdm.util.isArray(t[0])&&t[0].length>=1&&jsonOdm.util.isArray(t[0][0])&&t[0][0].length>=1&&jsonOdm.util.isArray(t[0][0][0])&&2===t[0][0][0].length)||jsonOdm.util.isArray(t[0][0][0][0]))return!1;t=new jsonOdm.Geo.MultiPolygon(t)}return t},jsonOdm.Geo.FeatureCollection=function(t,e){this.type="FeatureCollection",this.features=t||[],e&&(this.bbox=e)},jsonOdm.Geo.Feature=function(t,e,n,o){this.geometry=t||{},e&&(this.properties=e),n&&(this.bbox=n),o&&(this.id=o)},jsonOdm.Geo.BoundaryBox=function(t){var e=Object.create(Array.prototype);return e=Array.apply(e)||e,jsonOdm.util.isArray(t)?(e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3]):(e[0]=0,e[1]=0,e[2]=0,e[3]=0),e},jsonOdm.Geo.BoundaryBox.within=function(t,e){return jsonOdm.util.isArray(t)&&4===t.length?jsonOdm.Geo.Polygon.within(new jsonOdm.Geo.Polygon([[[t[0],t[1]],[t[2],t[1]],[t[2],t[3]],[t[0],t[3]],[t[0],t[1]]]]),e):!1},jsonOdm.Geo.Point=function(t,e){this.type="Point",this.coordinates=t,e&&(this.bbox=e)},jsonOdm.Geo.Point.within=function(t,e){var n,o;if(!t.coordinates)return!1;if("Point"===e.type)return e.coordinates[0]===t.coordinates[0]&&e.coordinates[1]===t.coordinates[1];if("MultiPoint"===e.type||"LineString"===e.type){for(n=0;e.coordinates&&n<e.coordinates.length;n++)if(e.coordinates[n][0]===t.coordinates[0]&&e.coordinates[n][1]===t.coordinates[1])return!0;return!1}if("MultiLineString"===e.type){for(n=0;e.coordinates&&n<e.coordinates.length;n++)for(o=0;e.coordinates[n]&&o<e.coordinates[n].length;o++)if(e.coordinates[n][o][0]===t.coordinates[0]&&e.coordinates[n][o][1]===t.coordinates[1])return!0;return!1}if("Polygon"===e.type)return jsonOdm.Geo.pointWithinPolygon(t.coordinates,e.coordinates?e.coordinates[0]:null);if("MultiPolygon"===e.type){for(n=0;e.coordinates&&n<e.coordinates.length;n++)if(jsonOdm.Geo.pointWithinPolygon(t.coordinates,e.coordinates[n]?e.coordinates[n][0]:null))return!0;return!1}if("GeometryCollection"===e.type&&jsonOdm.util.isArray(e.geometries)){for(n=0;n<e.geometries.length;n++)if(jsonOdm.Geo.Point.within(t,e.geometries[n]))return!0;return!1}return jsonOdm.Geo.pointWithinBounds(t.coordinates,e)},jsonOdm.Geo.Point.intersects=jsonOdm.Geo.Point.within,jsonOdm.Geo.MultiPoint=function(t,e){this.type="MultiPoint",this.coordinates=t,e&&(this.bbox=e)},jsonOdm.Geo.MultiPoint.within=function(t,e){var n,o,r,i;if(!t.coordinates||!jsonOdm.util.isArray(t.coordinates))return!1;if("Point"===e.type)return 1===t.coordinates.length&&t.coordinates[0][0]===e.coordinates[0]&&t.coordinates[0][1]===e.coordinates[1];if("MultiPoint"===e.type){for(o=0;t.coordinates&&o<t.coordinates.length;o++){for(i=!1,n=0;e.coordinates&&n<e.coordinates.length;n++)if(e.coordinates[n][0]===t.coordinates[o][0]&&e.coordinates[n][1]===t.coordinates[o][1]){i=!0;break}if(!i)return!1}return!0}if("LineString"===e.type){for(r=0;t.coordinates&&r<t.coordinates.length;r++)if(!jsonOdm.Geo.pointWithinLineString(t.coordinates[r],e.coordinates))return!1;return!0}if("MultiLineString"===e.type){for(r=0;t.coordinates&&r<t.coordinates.length;r++){for(i=!1,n=0;e.coordinates&&n<e.coordinates.length;n++)if(jsonOdm.Geo.pointWithinLineString(t.coordinates[r],e.coordinates[n])){i=!0;break}if(!i)return!1}return!0}if("Polygon"===e.type){for(n=0;t.coordinates&&n<t.coordinates.length;n++)if(!jsonOdm.Geo.pointWithinPolygon(t.coordinates[n],e.coordinates?e.coordinates[0]:null))return!1;return!0}if("MultiPolygon"===e.type){for(o=0;t.coordinates&&o<t.coordinates.length;o++){for(i=!1,n=0;e.coordinates&&n<e.coordinates.length;n++)if(jsonOdm.Geo.pointWithinPolygon(t.coordinates[o],e.coordinates[n]?e.coordinates[n][0]:null)){i=!0;break}if(!i)return!1}return!0}if("GeometryCollection"===e.type&&jsonOdm.util.isArray(e.geometries)){for(n=0;n<e.geometries.length;n++)if(jsonOdm.Geo.MultiPoint.within(t,e.geometries[n]))return!0;return!1}for(n=0;n<t.coordinates.length;n++)if(!jsonOdm.Geo.pointWithinBounds(t.coordinates[n],e))return!1;return!0},jsonOdm.Geo.MultiPoint.intersects=function(t,e){var n,o,r;if(!t.coordinates||!jsonOdm.util.isArray(t.coordinates))return!1;if("Point"===e.type)return jsonOdm.Geo.Point.intersects(e,t);if("MultiPoint"===e.type){for(o=0;t.coordinates&&o<t.coordinates.length;o++)for(n=0;e.coordinates&&n<e.coordinates.length;n++)if(e.coordinates[n][0]===t.coordinates[o][0]&&e.coordinates[n][1]===t.coordinates[o][1])return!0;return!1}if("LineString"===e.type){for(r=0;t.coordinates&&r<t.coordinates.length;r++)if(jsonOdm.Geo.pointWithinLineString(t.coordinates[r],e.coordinates))return!0;return!1}if("MultiLineString"===e.type){for(r=0;t.coordinates&&r<t.coordinates.length;r++)for(n=0;e.coordinates&&n<e.coordinates.length;n++)if(jsonOdm.Geo.pointWithinLineString(t.coordinates[r],e.coordinates[n]))return!0;return!1}if("Polygon"===e.type){for(n=0;t.coordinates&&n<t.coordinates.length;n++)if(jsonOdm.Geo.pointWithinPolygon(t.coordinates[n],e.coordinates?e.coordinates[0]:null))return!0;return!1}if("MultiPolygon"===e.type){for(o=0;t.coordinates&&o<t.coordinates.length;o++)for(n=0;e.coordinates&&n<e.coordinates.length;n++)if(jsonOdm.Geo.pointWithinPolygon(t.coordinates[o],e.coordinates[n]?e.coordinates[n][0]:null))return!0;return!1}if("GeometryCollection"===e.type&&jsonOdm.util.isArray(e.geometries)){for(n=0;n<e.geometries.length;n++)if(jsonOdm.Geo.MultiPoint.intersects(t,e.geometries[n]))return!0;return!1}for(n=0;n<t.coordinates.length;n++)if(jsonOdm.Geo.pointWithinBounds(t.coordinates[n],e))return!0;return!1},jsonOdm.Geo.LineString=function(t,e){this.type="LineString",this.coordinates=t,e&&(this.bbox=e)},jsonOdm.Geo.LineString.within=function(t,e){var n,o;if(!t.coordinates||!jsonOdm.util.isArray(t.coordinates))return!1;if("Point"===e.type||"MultiPoint"===e.type)return!1;if("LineString"===e.type)return jsonOdm.Geo.lineStringWithinLineString(t.coordinates,e.coordinates);if("MultiLineString"===e.type){for(n=0;e.coordinates&&n<e.coordinates.length;n++)if(jsonOdm.Geo.lineStringWithinLineString(t.coordinates,e.coordinates[n]))return!0;return!1}if("Polygon"===e.type){for(n=0;t.coordinates&&n<t.coordinates.length-1;n++)if(!jsonOdm.Geo.edgeWithinPolygon([t.coordinates[n],t.coordinates[n+1]],e.coordinates[0]))return!1;return!0}if("MultiPolygon"===e.type){for(n=0;e.coordinates&&n<e.coordinates.length;n++)for(o=0;t.coordinates&&o<t.coordinates.length-1;o++)if(jsonOdm.Geo.edgeWithinPolygon([t.coordinates[o],t.coordinates[o+1]],e.coordinates[n][0])&&o+1===t.coordinates.length-1)return!0;return!1}if("GeometryCollection"===e.type&&jsonOdm.util.isArray(e.geometries)){for(n=0;n<e.geometries.length;n++)if(jsonOdm.Geo.LineString.within(t,e.geometries[n]))return!0;return!1}for(n=0;n<t.coordinates.length;n++)if(!jsonOdm.Geo.pointWithinBounds(t.coordinates[n],e))return!1;return!0},jsonOdm.Geo.LineString.intersects=function(t,e){var n,o;if(!t.coordinates||!jsonOdm.util.isArray(t.coordinates))return!1;if("Point"===e.type)return jsonOdm.Geo.Point.intersects(e,t);if("MultiPoint"===e.type)return jsonOdm.Geo.MultiPoint.intersects(e,t);if("LineString"===e.type){for(n=0;n<t.coordinates.length-1;n++)if(jsonOdm.Geo.edgeIntersectsLineString([t.coordinates[n],t.coordinates[n+1]],e.coordinates))return!0;return!1}if("MultiLineString"===e.type){for(n=0;e.coordinates&&n<e.coordinates.length;n++)for(o=0;o<t.coordinates.length-1;o++)if(jsonOdm.Geo.edgeIntersectsLineString([t.coordinates[o],t.coordinates[o+1]],e.coordinates[n]))return!0;return!1}if("Polygon"===e.type){for(n=0;t.coordinates&&n<t.coordinates.length-1;n++)if(jsonOdm.Geo.edgeIntersectsPolygon([t.coordinates[n],t.coordinates[n+1]],e.coordinates[0]))return!0;return!1}if("MultiPolygon"===e.type){for(n=0;e.coordinates&&n<e.coordinates.length;n++)for(o=0;t.coordinates&&o<t.coordinates.length-1;o++)if(jsonOdm.Geo.edgeIntersectsPolygon([t.coordinates[o],t.coordinates[o+1]],e.coordinates[n][0]))return!0;return!1}if("GeometryCollection"===e.type&&jsonOdm.util.isArray(e.geometries)){for(n=0;n<e.geometries.length;n++)if(jsonOdm.Geo.LineString.intersects(t,e.geometries[n]))return!0;return!1}for(n=0;t.coordinates&&n<t.coordinates.length-1;n++)if(jsonOdm.Geo.edgeIntersectsBounds([t.coordinates[n],t.coordinates[n+1]],e))return!0;return!1},jsonOdm.Geo.MultiLineString=function(t,e){this.type="MultiLineString",this.coordinates=t,e&&(this.bbox=e)},jsonOdm.Geo.MultiLineString.within=function(t,e){var n,o,r,i;if(!t.coordinates||!jsonOdm.util.isArray(t.coordinates))return!1;if("Point"===e.type||"MultiPoint"===e.type)return!1;if("LineString"===e.type){for(n=0;t.coordinates&&n<t.coordinates.length;n++)if(!jsonOdm.Geo.lineStringWithinLineString(t.coordinates[n],e.coordinates))return!1;return!0}if("MultiLineString"===e.type){for(o=0;t.coordinates&&o<t.coordinates.length;o++){for(i=!1,n=0;e.coordinates&&n<e.coordinates.length;n++)if(jsonOdm.Geo.lineStringWithinLineString(t.coordinates[o],e.coordinates[n])){i=!0;break}if(!i)return!1}return!0}if("Polygon"===e.type){for(n=0;t.coordinates&&n<t.coordinates.length;n++)for(o=0;t.coordinates&&o<t.coordinates[n].length-1;o++)if(!jsonOdm.Geo.edgeWithinPolygon([t.coordinates[n][o],t.coordinates[n][o+1]],e.coordinates[0]))return!1;return!0}if("MultiPolygon"===e.type){for(o=0;t.coordinates&&o<t.coordinates.length;o++){for(i=!1,n=0;e.coordinates&&n<e.coordinates.length;n++)for(r=0;t.coordinates[o]&&r<t.coordinates[o].length-1;r++)if(jsonOdm.Geo.edgeWithinPolygon([t.coordinates[o][r],t.coordinates[o][r+1]],e.coordinates[n][0])&&r+1===t.coordinates[o].length-1){i=!0;break}if(!i)return!1}return!0}if("GeometryCollection"===e.type&&jsonOdm.util.isArray(e.geometries)){for(n=0;n<e.geometries.length;n++)if(jsonOdm.Geo.MultiLineString.within(t,e.geometries[n]))return!0;return!1}for(n=0;n<t.coordinates.length;n++)for(o=0;o<t.coordinates[n].length;o++)if(!jsonOdm.Geo.pointWithinBounds(t.coordinates[n][o],e))return!1;return!0},jsonOdm.Geo.MultiLineString.intersects=function(t,e){var n,o,r;if(!t.coordinates||!jsonOdm.util.isArray(t.coordinates))return!1;if("Point"===e.type)return jsonOdm.Geo.Point.intersects(e,t);if("MultiPoint"===e.type)return jsonOdm.Geo.MultiPoint.intersects(e,t);if("LineString"===e.type)return jsonOdm.Geo.LineString.intersects(e,t);if("MultiLineString"===e.type){for(o=0;t.coordinates&&o<t.coordinates.length;o++)for(r=0;t.coordinates[o]&&r<t.coordinates[o].length-1;r++)for(n=0;e.coordinates&&n<e.coordinates.length;n++)if(jsonOdm.Geo.edgeIntersectsLineString([t.coordinates[o][r],t.coordinates[o][r+1]],e.coordinates[n]))return!0;return!1}if("Polygon"===e.type){for(n=0;t.coordinates&&n<t.coordinates.length;n++)for(o=0;t.coordinates&&o<t.coordinates[n].length-1;o++)if(jsonOdm.Geo.edgeIntersectsPolygon([t.coordinates[n][o],t.coordinates[n][o+1]],e.coordinates[0]))return!0;return!1}if("MultiPolygon"===e.type){for(o=0;t.coordinates&&o<t.coordinates.length;o++)for(n=0;e.coordinates&&n<e.coordinates.length;n++)for(r=0;t.coordinates[o]&&r<t.coordinates[o].length-1;r++)if(jsonOdm.Geo.edgeIntersectsPolygon([t.coordinates[o][r],t.coordinates[o][r+1]],e.coordinates[n][0]))return!0;return!1}if("GeometryCollection"===e.type&&jsonOdm.util.isArray(e.geometries)){for(n=0;n<e.geometries.length;n++)if(jsonOdm.Geo.MultiLineString.intersects(t,e.geometries[n]))return!0;return!1}for(n=0;t.coordinates&&n<t.coordinates.length;n++)for(o=0;o<t.coordinates[n].length-1;o++)if(jsonOdm.Geo.edgeIntersectsBounds([t.coordinates[n][o],t.coordinates[n][o+1]],e))return!0;return!1},jsonOdm.Geo.Polygon=function(t,e){this.type="Polygon",this.coordinates=t,e&&(this.bbox=e)},jsonOdm.Geo.Polygon.within=function(t,e){var n,o;if(!t.coordinates||!jsonOdm.util.isArray(t.coordinates))return!1;if("Point"===e.type||"MultiPoint"===e.type||"LineString"===e.type||"MultiLineString"===e.type)return!1;if("Polygon"===e.type){for(n=0;t.coordinates[0]&&n<t.coordinates[0].length-1;n++)if(!jsonOdm.Geo.edgeWithinPolygon([t.coordinates[0][n],t.coordinates[0][n+1]],e.coordinates[0]))return!1;return!0}if("MultiPolygon"===e.type){for(n=0;e.coordinates&&n<e.coordinates.length;n++)for(o=0;t.coordinates[0]&&o<t.coordinates[0].length-1;o++){var r=jsonOdm.Geo.edgeWithinPolygon([t.coordinates[0][o],t.coordinates[0][o+1]],e.coordinates[n][0]);if(!r)break;if(r&&o+1===t.coordinates[0].length-1)return!0}return!1}if("GeometryCollection"===e.type&&jsonOdm.util.isArray(e.geometries)){for(n=0;n<e.geometries.length;n++)if(jsonOdm.Geo.Polygon.within(t,e.geometries[n]))return!0;return!1}for(n=0;t.coordinates[0]&&n<t.coordinates[0].length;n++)if(!jsonOdm.Geo.pointWithinBounds(t.coordinates[0][n],e))return!1;return!0},jsonOdm.Geo.Polygon.intersects=function(t,e){var n,o;if(!t.coordinates||!jsonOdm.util.isArray(t.coordinates))return!1;if("Point"===e.type)return jsonOdm.Geo.Point.intersects(e,t);if("MultiPoint"===e.type)return jsonOdm.Geo.MultiPoint.intersects(e,t);if("LineString"===e.type)return jsonOdm.Geo.LineString.intersects(e,t);if("MultiLineString"===e.type)return jsonOdm.Geo.MultiLineString.intersects(e,t);if("Polygon"===e.type){for(n=0;t.coordinates[0]&&n<t.coordinates[0].length-1;n++)if(jsonOdm.Geo.edgeIntersectsPolygon([t.coordinates[0][n],t.coordinates[0][n+1]],e.coordinates[0]))return!0;return!1}if("MultiPolygon"===e.type){for(n=0;e.coordinates&&n<e.coordinates.length;n++)for(o=0;t.coordinates[0]&&o<t.coordinates[0].length-1;o++)if(jsonOdm.Geo.edgeIntersectsPolygon([t.coordinates[0][o],t.coordinates[0][o+1]],e.coordinates[n][0]))return!0;return!1}if("GeometryCollection"===e.type&&jsonOdm.util.isArray(e.geometries)){for(n=0;n<e.geometries.length;n++)if(jsonOdm.Geo.Polygon.intersects(t,e.geometries[n]))return!0;return!1}for(n=0;t.coordinates[0]&&n<t.coordinates[0].length-1;n++)if(jsonOdm.Geo.edgeIntersectsBounds([t.coordinates[0][n],t.coordinates[0][n+1]],e))return!0;return!1},jsonOdm.Geo.MultiPolygon=function(t,e){this.type="MultiPolygon",this.coordinates=t,e&&(this.bbox=e)},jsonOdm.Geo.MultiPolygon.within=function(t,e){var n,o,r,i;if(!t.coordinates||!jsonOdm.util.isArray(t.coordinates))return!1;if("Point"===e.type||"MultiPoint"===e.type||"LineString"===e.type||"MultiLineString"===e.type)return!1;if("Polygon"===e.type){for(n=0;t.coordinates&&n<t.coordinates.length;n++)for(o=0;o<t.coordinates[n][0].length-1;o++)if(!jsonOdm.Geo.edgeWithinPolygon([t.coordinates[n][0][o],t.coordinates[n][0][o+1]],e.coordinates[0]))return!1;return!0}if("MultiPolygon"===e.type){for(n=0;t.coordinates&&n<t.coordinates.length;n++){for(i=!1,o=0;e.coordinates&&o<e.coordinates.length;o++)for(r=0;t.coordinates[n][0]&&r<t.coordinates[n][0].length-1;r++){var s=jsonOdm.Geo.edgeWithinPolygon([t.coordinates[n][0][r],t.coordinates[n][0][r+1]],e.coordinates[o][0]);if(!s)break;if(s&&r+1===t.coordinates[n][0].length-1){i=!0;break}}if(!i)return!1}return!0}if("GeometryCollection"===e.type&&jsonOdm.util.isArray(e.geometries)){for(n=0;n<e.geometries.length;n++)if(jsonOdm.Geo.MultiPolygon.within(t,e.geometries[n]))return!0;return!1}for(n=0;n<t.coordinates.length;n++)for(o=0;o<t.coordinates[n][0].length;o++)if(!jsonOdm.Geo.pointWithinBounds(t.coordinates[n][0][o],e))return!1;return!0},jsonOdm.Geo.MultiPolygon.intersects=function(t,e){var n,o,r;if(!t.coordinates||!jsonOdm.util.isArray(t.coordinates))return!1;if("Point"===e.type)return jsonOdm.Geo.Point.intersects(e,t);if("MultiPoint"===e.type)return jsonOdm.Geo.MultiPoint.intersects(e,t);if("LineString"===e.type)return jsonOdm.Geo.LineString.intersects(e,t);if("MultiLineString"===e.type)return jsonOdm.Geo.MultiLineString.intersects(e,t);if("Polygon"===e.type)return jsonOdm.Geo.Polygon.intersects(e,t);if("MultiPolygon"===e.type){for(n=0;t.coordinates&&n<t.coordinates.length;n++)for(o=0;e.coordinates&&o<e.coordinates.length;o++)for(r=0;t.coordinates[n][0]&&r<t.coordinates[n][0].length-1;r++)if(jsonOdm.Geo.pointWithinPolygon(t.coordinates[n][0][r],e.coordinates[o][0]))return!0;return!1}if("GeometryCollection"===e.type&&jsonOdm.util.isArray(e.geometries)){for(n=0;n<e.geometries.length;n++)if(jsonOdm.Geo.MultiPolygon.intersects(t,e.geometries[n]))return!0;return!1}for(n=0;n<t.coordinates.length;n++)for(o=0;o<t.coordinates[n][0].length-1;o++)if(jsonOdm.Geo.edgeIntersectsBounds([t.coordinates[n][0][o],t.coordinates[n][0][o+1]],e))return!0;return!1},jsonOdm.Geo.GeometryCollection=function(t,e){this.type="GeometryCollection",this.geometries=t,e&&(this.bbox=e)},jsonOdm.Geo.GeometryCollection.within=function(t,e){if(!jsonOdm.util.isArray(t.geometries)||!t.geometries.length||!e.type)return!1;for(var n=0;n<t.geometries.length;n++){if(!jsonOdm.Geo[t.geometries[n].type]||!jsonOdm.Geo[t.geometries[n].type].within)return!1;if(!jsonOdm.Geo[t.geometries[n].type].within(t.geometries[n],e))return!1}return!0},jsonOdm.Geo.GeometryCollection.intersects=function(t,e){if(!jsonOdm.util.isArray(t.geometries)||!t.geometries.length||!e.type)return!1;for(var n=0;n<t.geometries.length;n++)if(jsonOdm.Geo[t.geometries[n].type]&&jsonOdm.Geo[t.geometries[n].type].intersects&&jsonOdm.Geo[t.geometries[n].type].intersects(t.geometries[n],e))return!0;return!1},jsonOdm.Geo.pointWithinPolygon=function(t,e){if(!(jsonOdm.util.isArray(t)&&jsonOdm.util.isArray(e)&&e.length>2))return!1;var n,o=0;(e[0][0]!==e[e.length-1][0]||e[0][1]!==e[e.length-1][1])&&(e=e.concat([e[0]]));for(var r=0;r<e.length-1;r++){if(e[r][0]===t[0]&&e[r][1]===t[1])return!0;if(!(e[r][0]<t[0]&&e[r+1][0]<t[0]||e[r][1]<t[1]&&e[r+1][1]<t[1]||e[r][1]>t[1]&&e[r+1][1]>t[1])){if(n=(e[r][0]-e[r+1][0])*((t[1]-e[r+1][1])/(e[r][1]-e[r+1][1]))+e[r+1][0],n===t[0]&&t[1]<=Math.max(e[r][1],e[r+1][1])&&t[1]>=Math.min(e[r][1],e[r+1][1]))return!0;n>t[0]&&o++}}return o%2===1},jsonOdm.Geo.edgeWithinPolygon=function(t,e){if(!(jsonOdm.util.isArray(t)&&2===t.length&&jsonOdm.util.isArray(e)&&e.length>=2))return!1;if((e[0][0]!==e[e.length-1][0]||e[0][1]!==e[e.length-1][1])&&(e=e.concat([e[0]])),!jsonOdm.Geo.pointWithinPolygon(t[0],e)||!jsonOdm.Geo.pointWithinPolygon(t[1],e))return!1;for(var n=0;n<e.length-1;n++)if(jsonOdm.Geo.edgeIntersectsEdge(t,[e[n],e[n+1]],!1))return!1;return!0},jsonOdm.Geo.edgeIntersectsPolygon=function(t,e){if(!(jsonOdm.util.isArray(t)&&2===t.length&&jsonOdm.util.isArray(e)&&e.length>=2))return!1;if((e[0][0]!==e[e.length-1][0]||e[0][1]!==e[e.length-1][1])&&(e=e.concat([e[0]])),jsonOdm.Geo.pointWithinPolygon(t[0],e)||jsonOdm.Geo.pointWithinPolygon(t[1],e))return!0;for(var n=0;n<e.length-1;n++)if(jsonOdm.Geo.edgeIntersectsEdge(t,[e[n],e[n+1]]))return!0;return!1},jsonOdm.Geo.edgeIntersectsLineString=function(t,e){if(!jsonOdm.util.isArray(t)||2!==t.length||!jsonOdm.util.isArray(e))return!1;for(var n=0;n<e.length-1;n++)if(jsonOdm.Geo.edgeIntersectsEdge(t,[e[n],e[n+1]]))return!0;return!1},jsonOdm.Geo.edgeIntersectsEdge=function(t,e,n){n="undefined"==typeof n?!0:n;var o=[t[1][0]-t[0][0],t[1][1]-t[0][1]],r=[Math.min(t[0][0],t[1][0]),Math.min(t[0][1],t[1][1]),Math.max(t[0][0],t[1][0]),Math.max(t[0][1],t[1][1])],i=[e[1][0]-e[0][0],e[1][1]-e[0][1]],s=[Math.min(e[0][0],e[1][0]),Math.min(e[0][1],e[1][1]),Math.max(e[0][0],e[1][0]),Math.max(e[0][1],e[1][1])];if(r[0]>s[0]&&r[0]>s[2]||r[1]>s[1]&&r[1]>s[3]||s[0]>r[0]&&s[0]>r[2]||s[1]>r[1]&&s[1]>r[3])return!1;if(i[0]*o[1]-o[0]*i[1]===0)return n&&t[0][1]+(e[0][0]-t[0][0])/o[0]*o[1]===e[0][1];var u=(e[0][1]*i[0]+t[0][0]*i[1]-e[0][0]*i[1]-t[0][1]*i[0])/(o[1]*i[0]-o[0]*i[1]),d=t[0][0]+u*o[0],c=t[0][1]+u*o[1];return n?d>=r[0]&&d<=r[2]&&c>=r[1]&&c<=r[3]&&d>=s[0]&&d<=s[2]&&c>=s[1]&&c<=s[3]:d>r[0]&&d<r[2]&&c>r[1]&&c<r[3]&&d>s[0]&&d<s[2]&&c>s[1]&&c<s[3]},jsonOdm.Geo.pointWithinLineString=function(t,e){if(!(jsonOdm.util.isArray(t)&&jsonOdm.util.isArray(e)&&e.length>=2))return!1;for(var n=0;n<e.length-1;n++)if((t[0]>=e[n][0]&&t[0]<=e[n+1][0]&&e[n][0]<=e[n+1][0]||t[0]<=e[n][0]&&t[0]>=e[n+1][0]&&e[n][0]>=e[n+1][0])&&(t[1]>=e[n][1]&&t[1]<=e[n+1][1]&&e[n][1]<=e[n+1][1]||t[1]<=e[n][1]&&t[1]>=e[n+1][1]&&e[n][1]>=e[n+1][1])&&(e[n][0]===t[0]&&e[n][1]===t[1]||e[n+1][0]===t[0]&&e[n+1][1]===t[1]||e[n][1]-e[n+1][1]!=0&&(e[n][0]-e[n+1][0])*((t[1]-e[n+1][1])/(e[n][1]-e[n+1][1]))+e[n+1][0]===t[0]||e[n][0]-e[n+1][0]!=0&&(e[n][1]-e[n+1][1])*((t[0]-e[n+1][0])/(e[n][0]-e[n+1][0]))+e[n+1][1]===t[1]))return!0;return!1},jsonOdm.Geo.pointWithinBounds=function(t,e){return jsonOdm.util.isArray(t)&&jsonOdm.util.isArray(e)&&4===e.length?t[0]>=e[0]&&t[1]>=e[1]&&t[0]<=e[2]&&t[1]<=e[3]:!1},jsonOdm.Geo.edgeIntersectsBounds=function(t,e){return jsonOdm.util.isArray(t)&&jsonOdm.util.isArray(e)&&4===e.length?jsonOdm.Geo.edgeIntersectsPolygon(t,[[e[0],e[1]],[e[2],e[1]],[e[2],e[3]],[e[0],e[3]]]):!1},jsonOdm.Geo.lineStringWithinLineString=function(t,e){if(!jsonOdm.util.isArray(t)||!jsonOdm.util.isArray(e))return!1;var n,o;for(n=0;t&&n<t.length;n++){var r=!1;for(o=0;e&&o<e.length;o++)if(t[n][0]===e[o][0]&&t[n][1]===e[o][1]){if(n+1===t.length)return!0;if(!(e[o+1]&&t[n+1][0]===e[o+1][0]&&t[n+1][1]===e[o+1][1]||t[n+1][0]===e[o][0]&&t[n+1][1]===e[o][1]||o>0&&t[n+1][0]===e[o-1][0]&&t[n+1][1]===e[o-1][1]))return!1;r=!0}if(!r)return!1}return!0},"undefined"==typeof jsonOdm)var jsonOdm=new JsonOdm;if(jsonOdm.Collection=function(t){var e=Object.create(Array.prototype);return e=Array.apply(e)||e,"undefined"!=typeof t&&jsonOdm.selectedSource&&jsonOdm.selectedSource[t]&&(e=e.concat(jsonOdm.selectedSource[t])),jsonOdm.Collection.decorate(e),e.$branch=function(){var t=jsonOdm.util.branch(e,arguments);return jsonOdm.Collection.decorate(t),t},e},jsonOdm.Collection.decorate=function(t){var e=function(t){jsonOdm.util.isArray(t)&&(t.$hasMany=function(e,n,o,r){"string"==typeof o&&(r=r||o);var i=o;"string"==typeof o&&jsonOdm.selectedSource&&jsonOdm.selectedSource[o]&&(i=jsonOdm.selectedSource[o]);for(var s=0;s<t.length;s++){var u=e;if(t[s].hasOwnProperty(e)&&(u=t[s][e]),"undefined"==typeof t[s][r])for(var d=0;u.length&&d<u.length;d++){for(var c=null,a=0;a<i.length;a++)if(u[d]==i[a][n]){c=i[a];break}null!=c&&(t[s][r]||(t[s][r]=[]),t[s][r].push(c))}}},t.$hasOne=function(e,n,o,r){"string"==typeof o&&(r=r||o);var i=o;"string"==typeof o&&jsonOdm.selectedSource&&jsonOdm.selectedSource[o]&&(i=jsonOdm.selectedSource[o]);for(var s=0;s<t.length;s++){var u;if(t[s].hasOwnProperty(e)&&(u=t[s][e]),"undefined"==typeof t[s][r]){for(var d=null,c=0;c<i.length;c++)if(u==i[c][n]){d=i[c];break}null!=d&&(t[s][r]=d)}}},t.$query=function(){return new jsonOdm.Query(t)})};e(t)},"undefined"==typeof jsonOdm)var jsonOdm=new JsonOdm;jsonOdm.Query=function(t){this.$$commandQueue=[],this.$$aggregationBeforeCollectQueue=[],this.$$aggregationResultQueue=[],this.$$collection=t||[],this.$$accumulation=!1},jsonOdm.Query.prototype.$delete=function(){if(this.$$commandQueue.length<1)return this;for(var t=0;t<this.$$collection.length;){for(var e=!0,n=0;n<this.$$commandQueue.length&&(e=e&&this.$$commandQueue[n](this.$$collection[t]));n++);e?this.$$collection.splice(t,1):t++}return this},jsonOdm.Query.prototype.$result=function(t,e){if(this.$$commandQueue.length<1&&this.$$aggregationBeforeCollectQueue<1)return this.$$collection;t="undefined"==typeof t?0:t,e="undefined"==typeof e?this.$$collection.length:e;var n,o,r,i=new jsonOdm.Collection;for(o=0;o<this.$$collection.length;o++){var s=!0;for(r=0;r<this.$$commandQueue.length;r++){var u=this.$$commandQueue[r](this.$$collection[o]);if(!(s=s&&null!==u&&u!==!1&&"undefined"!=typeof u))break}if(s){if(t>0){t--;continue}if(0>=e)return i;for(n=this.$$collection[o],r=0;r<this.$$aggregationBeforeCollectQueue.length;r++)n=this.$$aggregationBeforeCollectQueue[r](o,n);i.push(n),e--}}for(o=0;o<this.$$aggregationResultQueue.length;o++)i=this.$$aggregationResultQueue[o](i);return i},jsonOdm.Query.prototype.$all=function(){return this.$result()},jsonOdm.Query.prototype.$first=function(){return this.$result(0,1)[0]},jsonOdm.Query.prototype.$aggregateCollection=function(t,e,n){return"function"==typeof t&&(t=[t]),"function"==typeof e&&(e=[e]),"function"==typeof n&&(n=[n]),jsonOdm.util.isArray(t)&&(this.$$commandQueue=this.$$commandQueue.concat(t)),jsonOdm.util.isArray(e)&&(this.$$aggregationBeforeCollectQueue=this.$$aggregationBeforeCollectQueue.concat(e)),jsonOdm.util.isArray(n)&&(this.$$aggregationResultQueue=this.$$aggregationResultQueue.concat(n)),this},jsonOdm.Query.prototype.$group=function(){var t=arguments,e=!1,n=[];return arguments.length>1&&!jsonOdm.util.isArray(arguments[arguments.length-1])&&!jsonOdm.util.is(arguments[arguments.length-1],"string")&&"object"==typeof arguments[arguments.length-1]&&(e=arguments[arguments.length-1],t=Array.prototype.slice.call(arguments,0,arguments.length-1)),this.$aggregateCollection(function(t,e){var n={};return function(o){for(var r,i={},s=n,u=0;u<t.length;u++){var d=jsonOdm.util.isArray(t[u])?t[u]:[t[u]];r=jsonOdm.util.branch(o,d),u<t.length-1&&("undefined"==typeof s[""+r]&&(s[""+r]={}),s=s[""+r]);for(var c=i,a=0;a<d.length-1;a++)"undefined"==typeof c[d[a]]&&(c[d[a]]={}),c=c[d[a]];c[d[d.length-1]]=r}return s[""+r]||(s[""+r]={accumulationObject:i,subResultSet:[]},e.push(s[""+r])),s[""+r].subResultSet.push(o),!0}}(t,n),null,function(t,e){function n(t){for(var e in t)t.hasOwnProperty(e)&&(t[e]instanceof jsonOdm.Query&&(t[e].$$accumulation=!1),"object"==typeof t[e]&&n(t[e]))}return function(){for(var o=new jsonOdm.Collection,r=0;r<t.length;r++)if(e===!1)o.push(t[r].accumulationObject);else{n(e);for(var i={},s=0;s<t[r].subResultSet.length;s++)i=jsonOdm.util.projectElement(e,t[r].subResultSet[s]);for(s in t[r].accumulationObject)t[r].accumulationObject.hasOwnProperty(s)&&(i[s]=t[r].accumulationObject[s]);o.push(i)}return o}}(n,e))},jsonOdm.Query.prototype.$project=function(t){return this.$aggregateCollection(null,function(e,n){return jsonOdm.util.projectElement(t,n)})},jsonOdm.Query.prototype.$testCollection=function(t,e){var n=this.$$commandQueue.pop(),o=function(){return function(o){if(!(n instanceof jsonOdm.Collection||"function"==typeof n||"undefined"==typeof n)||"function"!=typeof e)return!1;var r="undefined"==typeof n?o:n instanceof jsonOdm.Collection?n:n(o);return!!e(r,t)}}();return this.$$commandQueue.push(o),this},jsonOdm.Query.prototype.$queryOperator=function(t,e){var n=function(t,e){return function(n){if("function"!=typeof e)return!1;for(var o=[],r=0;r<t.length;r++)if(t[r]instanceof jsonOdm.Query)for(var i=0;i<t[r].$$commandQueue.length;i++)o.push(t[r].$$commandQueue[i](n));else o.push(t[r]);return e(o)}}(t,e),o=new jsonOdm.Query(this.$$collection);return o.$$commandQueue.push(n),o},jsonOdm.Query.prototype.$branch=function(t){if("undefined"==typeof t)return this;var e=function(t){return function(e){return jsonOdm.util.branch(e,t)}}(arguments),n=new jsonOdm.Query(this.$$collection);return n.$$commandQueue.push(e),n},jsonOdm.Query.prototype.$modifyField=function(t){var e=function(t,e){return function(n){return n=null!==e?e(n):n,"function"==typeof t?t(n):n}}(t,this.$$commandQueue.length?this.$$commandQueue[this.$$commandQueue.length-1]:null);return this.$$commandQueue.push(e),this},jsonOdm.Query.stringFiledModifyer=["charAt","charCodeAt","concat","fromCharCode","indexOf","lastIndexOf","localeCompare","match","replace","search","slice","split","substr","substring","toLocaleLowerCase","toLocaleUpperCase","toLowerCase","toUpperCase","trim","valueOf"];for(var i=0;i<jsonOdm.Query.stringFiledModifyer.length;i++)jsonOdm.Query.prototype["$"+jsonOdm.Query.stringFiledModifyer[i]]=createQueryStringModifier(jsonOdm.Query.stringFiledModifyer[i]);jsonOdm.Query.prototype.$accumulator=function(t,e){t="string"==typeof t?[t]:t;var n=new jsonOdm.Query(this.$$collection),o=function(t,e,n,o){return function(r){var i=null!==t?jsonOdm.util.branch(r,t):t;return n.$$accumulation=e(i,n.$$accumulation,r),o.$$accumulation=n.$$accumulation,i}}(t,e,n,this);return n.$$commandQueue.push(o),n},jsonOdm.Query.prototype.$sum=function(t){return this.$accumulator(t,function(t,e){return e===!1&&(e=0),t+e})},jsonOdm.Query.prototype.$avg=function(t){var e,n;return this.$accumulator(t,function(t,o){return o===!1&&(e=0,n=0),n+=t,e++,n/e})},jsonOdm.Query.prototype.$max=function(t){return this.$accumulator(t,function(t,e){return e===!1&&(e=t),Math.max(t,e)})},jsonOdm.Query.prototype.$min=function(t){return this.$accumulator(t,function(t,e){return e===!1&&(e=t),Math.min(t,e)})},jsonOdm.Query.prototype.$count=function(){return this.$accumulator(null,function(t,e){return e===!1&&(e=0),++e})},jsonOdm.Query.prototype.$push=function(){var t=new jsonOdm.Query(this.$$collection),e=function(t,e){return function(n){return t.$$accumulation=t.$$accumulation===!1?[]:t.$$accumulation,t.$$accumulation.push(n),e.$$accumulation=t.$$accumulation,!0}}(t,this);return t.$$commandQueue.push(e),t},jsonOdm.Query.prototype.$add=function(){return this.$queryOperator(arguments,function(t){for(var e=t.length>0?t[0]:0,n=1;n<t.length;n++)e+=t[n];return e})},jsonOdm.Query.prototype.$subtract=function(t){return"undefined"==typeof t?this:this.$queryOperator(arguments,function(t){for(var e=t.length>0?t[0]:0,n=1;n<t.length;n++)e-=t[n];return e})},jsonOdm.Query.prototype.$multiply=function(t){return"undefined"==typeof t?this:this.$queryOperator(arguments,function(t){for(var e=t.length>0?t[0]:0,n=1;n<t.length;n++)e*=t[n];return e})},jsonOdm.Query.prototype.$divide=function(t){return"undefined"==typeof t?this:this.$queryOperator(arguments,function(t){for(var e=t.length>0?t[0]:0,n=1;n<t.length;n++)e/=t[n];
return e})},jsonOdm.Query.prototype.$modulo=function(t){return"undefined"==typeof t?this:this.$queryOperator(arguments,function(t){for(var e=t.length>0?t[0]:0,n=1;n<t.length;n++)e%=t[n];return e})},jsonOdm.Query.prototype.$eq=function(t){return"undefined"==typeof t?this:this.$testCollection(arguments,function(t,e){for(var n=0;n<e.length;n++)if(e[n]===t)return!0;return!1})},jsonOdm.Query.prototype.$in=function(t){return"undefined"==typeof t&&(t=[]),this.$testCollection(t,function(t,e){for(var n=0;n<e.length;n++)if(e[n]===t)return!0;return!1})},jsonOdm.Query.prototype.$ne=function(t){return"undefined"==typeof t?this:this.$testCollection(arguments,function(t,e){for(var n=0;n<e.length;n++)if(e[n]===t)return!1;return!0})},jsonOdm.Query.prototype.$nin=function(t){return"undefined"==typeof t&&(t=[]),this.$testCollection(t,function(t,e){for(var n=0;n<e.length;n++)if(e[n]===t)return!1;return!0})},jsonOdm.Query.prototype.$gt=function(t){return this.$testCollection(t,function(t,e){return t>e})},jsonOdm.Query.prototype.$gte=function(t){return this.$testCollection(t,function(t,e){return t>=e})},jsonOdm.Query.prototype.$lt=function(t){return this.$testCollection(t,function(t,e){return e>t})},jsonOdm.Query.prototype.$lte=function(t){return this.$testCollection(t,function(t,e){return e>=t})},jsonOdm.Query.prototype.$isNull=function(){return this.$testCollection(null,function(t){return"undefined"==typeof t||null===t})},jsonOdm.Query.prototype.$exists=function(){return this.$testCollection(null,function(t){return"undefined"!=typeof t})},jsonOdm.Query.prototype.$type=function(t){return"undefined"==typeof t?this.$testCollection([t],function(){return!1}):this.$testCollection(arguments,function(t,e){return jsonOdm.util.is(t,e)})},jsonOdm.Query.prototype.$mod=function(t,e){return"undefined"==typeof t||"undefined"==typeof e?this:this.$testCollection(arguments,function(t,e){return t%e[0]===e[1]})},jsonOdm.Query.prototype.$regex=function(t,e){return"string"==typeof t&&(t="string"==typeof e?new RegExp(t,e):new RegExp(t)),this.$testCollection(t,function(t,e){return e.test(t)})},jsonOdm.Query.prototype.$text=function(t){for(var e,n,o=/(^| )-([^ ]+)( |$)/g,r=/"([^"]+)"/g,i=[],s=[];null!==(e=o.exec(t));)i.push(e[2]);for(t=t.replace(o,"");null!==(n=r.exec(t));)s.push(n[1]);t=t.replace(r,"");var u=t.split(" ");return this.$testCollection([i,s,u],function(t,e){for(var n=0;n<e[0].length;n++)if(t.indexOf(e[0][n])>-1)return!1;for(n=0;n<e[1].length;n++)if(t.indexOf(e[1][n])<0)return!1;for(n=0;n<e[2].length;n++)if(t.indexOf(e[2][n])>-1)return!0;return!!e[1].length})},jsonOdm.Query.prototype.$where=function(t){return this.$testCollection(t,function(t,e){return"function"!=typeof e?!1:e.apply(t)})},jsonOdm.Query.prototype.$geoWithin=function(t){return this.$testCollection(jsonOdm.Geo.detectAsGeometry(t),function(t,e){return jsonOdm.Geo[t.type]&&jsonOdm.Geo[t.type].within&&jsonOdm.Geo[t.type].within(t,e)})},jsonOdm.Query.prototype.$geoIntersects=function(t){return this.$testCollection(jsonOdm.Geo.detectAsGeometry(t),function(t,e){return jsonOdm.Geo[t.type]&&jsonOdm.Geo[t.type].intersects&&jsonOdm.Geo[t.type].intersects(t,e)})},jsonOdm.Query.prototype.$and=function(){return this.$queryOperator(arguments,function(t){for(var e=0;e<t.length;e++)if(!t[e])return!1;return!0})},jsonOdm.Query.prototype.$nand=function(){return this.$queryOperator(arguments,function(t){for(var e=0;e<t.length;e++)if(!t[e])return!0;return!1})},jsonOdm.Query.prototype.$not=jsonOdm.Query.prototype.$nand,jsonOdm.Query.prototype.$or=function(){return this.$queryOperator(arguments,function(t){for(var e=0;e<t.length;e++)if(t[e])return!0;return!1})},jsonOdm.Query.prototype.$nor=function(){return this.$queryOperator(arguments,function(t){for(var e=0;e<t.length;e++)if(t[e])return!1;return!0})};
"use strict";function JsonOdm(){var t=this;this.sources={},this.selectedSource={},this.addSource=function(e,o,n){"object"==typeof o&&("undefined"==typeof t.sources[e]&&(t.sources[e]=o),n&&(t.selectedSource=o))},this.selectSource=function(e){"undefined"!=typeof t.sources[e]&&(t.selectedSource=t.sources[e])}}function createQueryStringModifier(t){return function(){return this.$modifyField(function(t,e){return function(o){return"string"==typeof o&&String.prototype.hasOwnProperty(e)?String.prototype[e].apply(o,t):o}}(arguments,t))}}var root="undefined"!=typeof window?window:global,jsonOdm=new JsonOdm;if(root.jsonOdm||(root.jsonOdm=jsonOdm),"undefined"!=typeof module&&module.exports&&(module.exports=jsonOdm),"undefined"==typeof jsonOdm)var jsonOdm=new JsonOdm;if(jsonOdm.Util=function(){},jsonOdm.Util.prototype.isArray=function(t){return Array.isArray?Array.isArray(t):"[object Array]"===Object.prototype.toString.call(t)},jsonOdm.Util.prototype.is=function(t,e){e="string"==typeof e?[e]:e;var o=Object.prototype.toString.call(t);o=o.substring(8,o.length-1).toLowerCase();for(var n=0;n<e.length;n++){var r=e[n].toLowerCase();if("array"===r&&this.isArray(t))return!0;if(r===o)return!0;if(typeof t===r)return!0}return!1},jsonOdm.Util.prototype.objectKeysPolyfill=function(){var t=Object.prototype.hasOwnProperty,e=!{toString:null}.propertyIsEnumerable("toString"),o=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],n=o.length;return function(r){if("object"!=typeof r&&("function"!=typeof r||null===r))throw new TypeError("Object.keys called on non-object");var i,s,u=[];for(i in r)t.call(r,i)&&u.push(i);if(e)for(s=0;s<n;s++)t.call(r,o[s])&&u.push(o[s]);return u}}(),jsonOdm.Util.prototype.objectKeys=Object.keys||jsonOdm.Util.prototype.objectKeysPolyfill,jsonOdm.Util.prototype.branch=function(t,e){function o(){if(arguments&&arguments.length&&this){var t=this[arguments[0]];return t?o.apply(t,Array.prototype.slice.call(arguments,1)):t}return this}return o.apply(t,e)},jsonOdm.Util.prototype.projectElement=function(t,e,o){var n={};for(var r in t)t.hasOwnProperty(r)&&(1==t[r]?n[r]=e[r]:"function"==typeof t[r]?n[r]=t[r](o||e):t[r]instanceof jsonOdm.Query?(n[r]=t[r].$$commandQueue[t[r].$$commandQueue.length-1](e),t[r].$$accumulation!==!1&&(n[r]=t[r].$$accumulation)):"object"==typeof t[r]&&(n[r]=this.projectElement(t[r],e[r],o||e)));return n},jsonOdm.util=new jsonOdm.Util,"undefined"==typeof jsonOdm)var jsonOdm=new JsonOdm;if(jsonOdm.Geo=function(){},jsonOdm.Geo.detectAsGeometry=function(t){if(!t.type)if(jsonOdm.util.isArray(t)&&2===t.length&&!jsonOdm.util.isArray(t[0]))t=new jsonOdm.Geo.Point(t);else if(jsonOdm.util.isArray(t)&&4===t.length&&!jsonOdm.util.isArray(t[0]))t=new jsonOdm.Geo.BoundaryBox(t);else if(jsonOdm.util.isArray(t)&&t.length>=1&&jsonOdm.util.isArray(t[0])&&2===t[0].length&&!jsonOdm.util.isArray(t[0][0]))t=new jsonOdm.Geo.LineString(t);else if(jsonOdm.util.isArray(t)&&t.length>=1&&jsonOdm.util.isArray(t[0])&&t[0].length>=1&&jsonOdm.util.isArray(t[0][0])&&2===t[0][0].length&&!jsonOdm.util.isArray(t[0][0][0]))t=new jsonOdm.Geo.Polygon(t);else{if(!(jsonOdm.util.isArray(t)&&t.length>=1&&jsonOdm.util.isArray(t[0])&&t[0].length>=1&&jsonOdm.util.isArray(t[0][0])&&t[0][0].length>=1&&jsonOdm.util.isArray(t[0][0][0])&&2===t[0][0][0].length)||jsonOdm.util.isArray(t[0][0][0][0]))return!1;t=new jsonOdm.Geo.MultiPolygon(t)}return t},jsonOdm.Geo.FeatureCollection=function(t,e){this.type="FeatureCollection",this.features=t||[],e&&(this.bbox=e)},jsonOdm.Geo.Feature=function(t,e,o,n){this.geometry=t||{},e&&(this.properties=e),o&&(this.bbox=o),n&&(this.id=n)},jsonOdm.Geo.BoundaryBox=function(t){var e=Object.create(Array.prototype);return e=Array.apply(e)||e,jsonOdm.util.isArray(t)?(e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3]):(e[0]=0,e[1]=0,e[2]=0,e[3]=0),e},jsonOdm.Geo.BoundaryBox.within=function(t,e){return!(!jsonOdm.util.isArray(t)||4!==t.length)&&jsonOdm.Geo.Polygon.within(new jsonOdm.Geo.Polygon([[[t[0],t[1]],[t[2],t[1]],[t[2],t[3]],[t[0],t[3]],[t[0],t[1]]]]),e)},jsonOdm.Geo.Point=function(t,e){this.type="Point",this.coordinates=t,e&&(this.bbox=e)},jsonOdm.Geo.Point.within=function(t,e){var o,n;if(!t.coordinates)return!1;if("Point"===e.type)return e.coordinates[0]===t.coordinates[0]&&e.coordinates[1]===t.coordinates[1];if("MultiPoint"===e.type||"LineString"===e.type){for(o=0;e.coordinates&&o<e.coordinates.length;o++)if(e.coordinates[o][0]===t.coordinates[0]&&e.coordinates[o][1]===t.coordinates[1])return!0;return!1}if("MultiLineString"===e.type){for(o=0;e.coordinates&&o<e.coordinates.length;o++)for(n=0;e.coordinates[o]&&n<e.coordinates[o].length;n++)if(e.coordinates[o][n][0]===t.coordinates[0]&&e.coordinates[o][n][1]===t.coordinates[1])return!0;return!1}if("Polygon"===e.type)return jsonOdm.Geo.pointWithinPolygon(t.coordinates,e.coordinates?e.coordinates[0]:null);if("MultiPolygon"===e.type){for(o=0;e.coordinates&&o<e.coordinates.length;o++)if(jsonOdm.Geo.pointWithinPolygon(t.coordinates,e.coordinates[o]?e.coordinates[o][0]:null))return!0;return!1}if("GeometryCollection"===e.type&&jsonOdm.util.isArray(e.geometries)){for(o=0;o<e.geometries.length;o++)if(jsonOdm.Geo.Point.within(t,e.geometries[o]))return!0;return!1}return jsonOdm.Geo.pointWithinBounds(t.coordinates,e)},jsonOdm.Geo.Point.intersects=jsonOdm.Geo.Point.within,jsonOdm.Geo.MultiPoint=function(t,e){this.type="MultiPoint",this.coordinates=t,e&&(this.bbox=e)},jsonOdm.Geo.MultiPoint.within=function(t,e){var o,n,r,i;if(!t.coordinates||!jsonOdm.util.isArray(t.coordinates))return!1;if("Point"===e.type)return 1===t.coordinates.length&&t.coordinates[0][0]===e.coordinates[0]&&t.coordinates[0][1]===e.coordinates[1];if("MultiPoint"===e.type){for(n=0;t.coordinates&&n<t.coordinates.length;n++){for(i=!1,o=0;e.coordinates&&o<e.coordinates.length;o++)if(e.coordinates[o][0]===t.coordinates[n][0]&&e.coordinates[o][1]===t.coordinates[n][1]){i=!0;break}if(!i)return!1}return!0}if("LineString"===e.type){for(r=0;t.coordinates&&r<t.coordinates.length;r++)if(!jsonOdm.Geo.pointWithinLineString(t.coordinates[r],e.coordinates))return!1;return!0}if("MultiLineString"===e.type){for(r=0;t.coordinates&&r<t.coordinates.length;r++){for(i=!1,o=0;e.coordinates&&o<e.coordinates.length;o++)if(jsonOdm.Geo.pointWithinLineString(t.coordinates[r],e.coordinates[o])){i=!0;break}if(!i)return!1}return!0}if("Polygon"===e.type){for(o=0;t.coordinates&&o<t.coordinates.length;o++)if(!jsonOdm.Geo.pointWithinPolygon(t.coordinates[o],e.coordinates?e.coordinates[0]:null))return!1;return!0}if("MultiPolygon"===e.type){for(n=0;t.coordinates&&n<t.coordinates.length;n++){for(i=!1,o=0;e.coordinates&&o<e.coordinates.length;o++)if(jsonOdm.Geo.pointWithinPolygon(t.coordinates[n],e.coordinates[o]?e.coordinates[o][0]:null)){i=!0;break}if(!i)return!1}return!0}if("GeometryCollection"===e.type&&jsonOdm.util.isArray(e.geometries)){for(o=0;o<e.geometries.length;o++)if(jsonOdm.Geo.MultiPoint.within(t,e.geometries[o]))return!0;return!1}for(o=0;o<t.coordinates.length;o++)if(!jsonOdm.Geo.pointWithinBounds(t.coordinates[o],e))return!1;return!0},jsonOdm.Geo.MultiPoint.intersects=function(t,e){var o,n,r;if(!t.coordinates||!jsonOdm.util.isArray(t.coordinates))return!1;if("Point"===e.type)return jsonOdm.Geo.Point.intersects(e,t);if("MultiPoint"===e.type){for(n=0;t.coordinates&&n<t.coordinates.length;n++)for(o=0;e.coordinates&&o<e.coordinates.length;o++)if(e.coordinates[o][0]===t.coordinates[n][0]&&e.coordinates[o][1]===t.coordinates[n][1])return!0;return!1}if("LineString"===e.type){for(r=0;t.coordinates&&r<t.coordinates.length;r++)if(jsonOdm.Geo.pointWithinLineString(t.coordinates[r],e.coordinates))return!0;return!1}if("MultiLineString"===e.type){for(r=0;t.coordinates&&r<t.coordinates.length;r++)for(o=0;e.coordinates&&o<e.coordinates.length;o++)if(jsonOdm.Geo.pointWithinLineString(t.coordinates[r],e.coordinates[o]))return!0;return!1}if("Polygon"===e.type){for(o=0;t.coordinates&&o<t.coordinates.length;o++)if(jsonOdm.Geo.pointWithinPolygon(t.coordinates[o],e.coordinates?e.coordinates[0]:null))return!0;return!1}if("MultiPolygon"===e.type){for(n=0;t.coordinates&&n<t.coordinates.length;n++)for(o=0;e.coordinates&&o<e.coordinates.length;o++)if(jsonOdm.Geo.pointWithinPolygon(t.coordinates[n],e.coordinates[o]?e.coordinates[o][0]:null))return!0;return!1}if("GeometryCollection"===e.type&&jsonOdm.util.isArray(e.geometries)){for(o=0;o<e.geometries.length;o++)if(jsonOdm.Geo.MultiPoint.intersects(t,e.geometries[o]))return!0;return!1}for(o=0;o<t.coordinates.length;o++)if(jsonOdm.Geo.pointWithinBounds(t.coordinates[o],e))return!0;return!1},jsonOdm.Geo.LineString=function(t,e){this.type="LineString",this.coordinates=t,e&&(this.bbox=e)},jsonOdm.Geo.LineString.within=function(t,e){var o,n;if(!t.coordinates||!jsonOdm.util.isArray(t.coordinates))return!1;if("Point"===e.type||"MultiPoint"===e.type)return!1;if("LineString"===e.type)return jsonOdm.Geo.lineStringWithinLineString(t.coordinates,e.coordinates);if("MultiLineString"===e.type){for(o=0;e.coordinates&&o<e.coordinates.length;o++)if(jsonOdm.Geo.lineStringWithinLineString(t.coordinates,e.coordinates[o]))return!0;return!1}if("Polygon"===e.type){for(o=0;t.coordinates&&o<t.coordinates.length-1;o++)if(!jsonOdm.Geo.edgeWithinPolygon([t.coordinates[o],t.coordinates[o+1]],e.coordinates[0]))return!1;return!0}if("MultiPolygon"===e.type){for(o=0;e.coordinates&&o<e.coordinates.length;o++)for(n=0;t.coordinates&&n<t.coordinates.length-1;n++)if(jsonOdm.Geo.edgeWithinPolygon([t.coordinates[n],t.coordinates[n+1]],e.coordinates[o][0])&&n+1===t.coordinates.length-1)return!0;return!1}if("GeometryCollection"===e.type&&jsonOdm.util.isArray(e.geometries)){for(o=0;o<e.geometries.length;o++)if(jsonOdm.Geo.LineString.within(t,e.geometries[o]))return!0;return!1}for(o=0;o<t.coordinates.length;o++)if(!jsonOdm.Geo.pointWithinBounds(t.coordinates[o],e))return!1;return!0},jsonOdm.Geo.LineString.intersects=function(t,e){var o,n;if(!t.coordinates||!jsonOdm.util.isArray(t.coordinates))return!1;if("Point"===e.type)return jsonOdm.Geo.Point.intersects(e,t);if("MultiPoint"===e.type)return jsonOdm.Geo.MultiPoint.intersects(e,t);if("LineString"===e.type){for(o=0;o<t.coordinates.length-1;o++)if(jsonOdm.Geo.edgeIntersectsLineString([t.coordinates[o],t.coordinates[o+1]],e.coordinates))return!0;return!1}if("MultiLineString"===e.type){for(o=0;e.coordinates&&o<e.coordinates.length;o++)for(n=0;n<t.coordinates.length-1;n++)if(jsonOdm.Geo.edgeIntersectsLineString([t.coordinates[n],t.coordinates[n+1]],e.coordinates[o]))return!0;return!1}if("Polygon"===e.type){for(o=0;t.coordinates&&o<t.coordinates.length-1;o++)if(jsonOdm.Geo.edgeIntersectsPolygon([t.coordinates[o],t.coordinates[o+1]],e.coordinates[0]))return!0;return!1}if("MultiPolygon"===e.type){for(o=0;e.coordinates&&o<e.coordinates.length;o++)for(n=0;t.coordinates&&n<t.coordinates.length-1;n++)if(jsonOdm.Geo.edgeIntersectsPolygon([t.coordinates[n],t.coordinates[n+1]],e.coordinates[o][0]))return!0;return!1}if("GeometryCollection"===e.type&&jsonOdm.util.isArray(e.geometries)){for(o=0;o<e.geometries.length;o++)if(jsonOdm.Geo.LineString.intersects(t,e.geometries[o]))return!0;return!1}for(o=0;t.coordinates&&o<t.coordinates.length-1;o++)if(jsonOdm.Geo.edgeIntersectsBounds([t.coordinates[o],t.coordinates[o+1]],e))return!0;return!1},jsonOdm.Geo.MultiLineString=function(t,e){this.type="MultiLineString",this.coordinates=t,e&&(this.bbox=e)},jsonOdm.Geo.MultiLineString.within=function(t,e){var o,n,r,i;if(!t.coordinates||!jsonOdm.util.isArray(t.coordinates))return!1;if("Point"===e.type||"MultiPoint"===e.type)return!1;if("LineString"===e.type){for(o=0;t.coordinates&&o<t.coordinates.length;o++)if(!jsonOdm.Geo.lineStringWithinLineString(t.coordinates[o],e.coordinates))return!1;return!0}if("MultiLineString"===e.type){for(n=0;t.coordinates&&n<t.coordinates.length;n++){for(i=!1,o=0;e.coordinates&&o<e.coordinates.length;o++)if(jsonOdm.Geo.lineStringWithinLineString(t.coordinates[n],e.coordinates[o])){i=!0;break}if(!i)return!1}return!0}if("Polygon"===e.type){for(o=0;t.coordinates&&o<t.coordinates.length;o++)for(n=0;t.coordinates&&n<t.coordinates[o].length-1;n++)if(!jsonOdm.Geo.edgeWithinPolygon([t.coordinates[o][n],t.coordinates[o][n+1]],e.coordinates[0]))return!1;return!0}if("MultiPolygon"===e.type){for(n=0;t.coordinates&&n<t.coordinates.length;n++){for(i=!1,o=0;e.coordinates&&o<e.coordinates.length;o++)for(r=0;t.coordinates[n]&&r<t.coordinates[n].length-1;r++)if(jsonOdm.Geo.edgeWithinPolygon([t.coordinates[n][r],t.coordinates[n][r+1]],e.coordinates[o][0])&&r+1===t.coordinates[n].length-1){i=!0;break}if(!i)return!1}return!0}if("GeometryCollection"===e.type&&jsonOdm.util.isArray(e.geometries)){for(o=0;o<e.geometries.length;o++)if(jsonOdm.Geo.MultiLineString.within(t,e.geometries[o]))return!0;return!1}for(o=0;o<t.coordinates.length;o++)for(n=0;n<t.coordinates[o].length;n++)if(!jsonOdm.Geo.pointWithinBounds(t.coordinates[o][n],e))return!1;return!0},jsonOdm.Geo.MultiLineString.intersects=function(t,e){var o,n,r;if(!t.coordinates||!jsonOdm.util.isArray(t.coordinates))return!1;if("Point"===e.type)return jsonOdm.Geo.Point.intersects(e,t);if("MultiPoint"===e.type)return jsonOdm.Geo.MultiPoint.intersects(e,t);if("LineString"===e.type)return jsonOdm.Geo.LineString.intersects(e,t);if("MultiLineString"===e.type){for(n=0;t.coordinates&&n<t.coordinates.length;n++)for(r=0;t.coordinates[n]&&r<t.coordinates[n].length-1;r++)for(o=0;e.coordinates&&o<e.coordinates.length;o++)if(jsonOdm.Geo.edgeIntersectsLineString([t.coordinates[n][r],t.coordinates[n][r+1]],e.coordinates[o]))return!0;return!1}if("Polygon"===e.type){for(o=0;t.coordinates&&o<t.coordinates.length;o++)for(n=0;t.coordinates&&n<t.coordinates[o].length-1;n++)if(jsonOdm.Geo.edgeIntersectsPolygon([t.coordinates[o][n],t.coordinates[o][n+1]],e.coordinates[0]))return!0;return!1}if("MultiPolygon"===e.type){for(n=0;t.coordinates&&n<t.coordinates.length;n++)for(o=0;e.coordinates&&o<e.coordinates.length;o++)for(r=0;t.coordinates[n]&&r<t.coordinates[n].length-1;r++)if(jsonOdm.Geo.edgeIntersectsPolygon([t.coordinates[n][r],t.coordinates[n][r+1]],e.coordinates[o][0]))return!0;return!1}if("GeometryCollection"===e.type&&jsonOdm.util.isArray(e.geometries)){for(o=0;o<e.geometries.length;o++)if(jsonOdm.Geo.MultiLineString.intersects(t,e.geometries[o]))return!0;return!1}for(o=0;t.coordinates&&o<t.coordinates.length;o++)for(n=0;n<t.coordinates[o].length-1;n++)if(jsonOdm.Geo.edgeIntersectsBounds([t.coordinates[o][n],t.coordinates[o][n+1]],e))return!0;return!1},jsonOdm.Geo.Polygon=function(t,e){this.type="Polygon",this.coordinates=t,e&&(this.bbox=e)},jsonOdm.Geo.Polygon.within=function(t,e){var o,n;if(!t.coordinates||!jsonOdm.util.isArray(t.coordinates))return!1;if("Point"===e.type||"MultiPoint"===e.type||"LineString"===e.type||"MultiLineString"===e.type)return!1;if("Polygon"===e.type){for(o=0;t.coordinates[0]&&o<t.coordinates[0].length-1;o++)if(!jsonOdm.Geo.edgeWithinPolygon([t.coordinates[0][o],t.coordinates[0][o+1]],e.coordinates[0]))return!1;return!0}if("MultiPolygon"===e.type){for(o=0;e.coordinates&&o<e.coordinates.length;o++)for(n=0;t.coordinates[0]&&n<t.coordinates[0].length-1;n++){var r=jsonOdm.Geo.edgeWithinPolygon([t.coordinates[0][n],t.coordinates[0][n+1]],e.coordinates[o][0]);if(!r)break;if(r&&n+1===t.coordinates[0].length-1)return!0}return!1}if("GeometryCollection"===e.type&&jsonOdm.util.isArray(e.geometries)){for(o=0;o<e.geometries.length;o++)if(jsonOdm.Geo.Polygon.within(t,e.geometries[o]))return!0;return!1}for(o=0;t.coordinates[0]&&o<t.coordinates[0].length;o++)if(!jsonOdm.Geo.pointWithinBounds(t.coordinates[0][o],e))return!1;return!0},jsonOdm.Geo.Polygon.intersects=function(t,e){var o,n;if(!t.coordinates||!jsonOdm.util.isArray(t.coordinates))return!1;if("Point"===e.type)return jsonOdm.Geo.Point.intersects(e,t);if("MultiPoint"===e.type)return jsonOdm.Geo.MultiPoint.intersects(e,t);if("LineString"===e.type)return jsonOdm.Geo.LineString.intersects(e,t);if("MultiLineString"===e.type)return jsonOdm.Geo.MultiLineString.intersects(e,t);if("Polygon"===e.type){for(o=0;t.coordinates[0]&&o<t.coordinates[0].length-1;o++)if(jsonOdm.Geo.edgeIntersectsPolygon([t.coordinates[0][o],t.coordinates[0][o+1]],e.coordinates[0]))return!0;return!1}if("MultiPolygon"===e.type){for(o=0;e.coordinates&&o<e.coordinates.length;o++)for(n=0;t.coordinates[0]&&n<t.coordinates[0].length-1;n++)if(jsonOdm.Geo.edgeIntersectsPolygon([t.coordinates[0][n],t.coordinates[0][n+1]],e.coordinates[o][0]))return!0;return!1}if("GeometryCollection"===e.type&&jsonOdm.util.isArray(e.geometries)){for(o=0;o<e.geometries.length;o++)if(jsonOdm.Geo.Polygon.intersects(t,e.geometries[o]))return!0;return!1}for(o=0;t.coordinates[0]&&o<t.coordinates[0].length-1;o++)if(jsonOdm.Geo.edgeIntersectsBounds([t.coordinates[0][o],t.coordinates[0][o+1]],e))return!0;return!1},jsonOdm.Geo.MultiPolygon=function(t,e){this.type="MultiPolygon",this.coordinates=t,e&&(this.bbox=e)},jsonOdm.Geo.MultiPolygon.within=function(t,e){var o,n,r,i;if(!t.coordinates||!jsonOdm.util.isArray(t.coordinates))return!1;if("Point"===e.type||"MultiPoint"===e.type||"LineString"===e.type||"MultiLineString"===e.type)return!1;if("Polygon"===e.type){for(o=0;t.coordinates&&o<t.coordinates.length;o++)for(n=0;n<t.coordinates[o][0].length-1;n++)if(!jsonOdm.Geo.edgeWithinPolygon([t.coordinates[o][0][n],t.coordinates[o][0][n+1]],e.coordinates[0]))return!1;return!0}if("MultiPolygon"===e.type){for(o=0;t.coordinates&&o<t.coordinates.length;o++){for(i=!1,n=0;e.coordinates&&n<e.coordinates.length;n++)for(r=0;t.coordinates[o][0]&&r<t.coordinates[o][0].length-1;r++){var s=jsonOdm.Geo.edgeWithinPolygon([t.coordinates[o][0][r],t.coordinates[o][0][r+1]],e.coordinates[n][0]);if(!s)break;if(s&&r+1===t.coordinates[o][0].length-1){i=!0;break}}if(!i)return!1}return!0}if("GeometryCollection"===e.type&&jsonOdm.util.isArray(e.geometries)){for(o=0;o<e.geometries.length;o++)if(jsonOdm.Geo.MultiPolygon.within(t,e.geometries[o]))return!0;return!1}for(o=0;o<t.coordinates.length;o++)for(n=0;n<t.coordinates[o][0].length;n++)if(!jsonOdm.Geo.pointWithinBounds(t.coordinates[o][0][n],e))return!1;return!0},jsonOdm.Geo.MultiPolygon.intersects=function(t,e){var o,n,r;if(!t.coordinates||!jsonOdm.util.isArray(t.coordinates))return!1;if("Point"===e.type)return jsonOdm.Geo.Point.intersects(e,t);if("MultiPoint"===e.type)return jsonOdm.Geo.MultiPoint.intersects(e,t);if("LineString"===e.type)return jsonOdm.Geo.LineString.intersects(e,t);if("MultiLineString"===e.type)return jsonOdm.Geo.MultiLineString.intersects(e,t);if("Polygon"===e.type)return jsonOdm.Geo.Polygon.intersects(e,t);if("MultiPolygon"===e.type){for(o=0;t.coordinates&&o<t.coordinates.length;o++)for(n=0;e.coordinates&&n<e.coordinates.length;n++)for(r=0;t.coordinates[o][0]&&r<t.coordinates[o][0].length-1;r++)if(jsonOdm.Geo.pointWithinPolygon(t.coordinates[o][0][r],e.coordinates[n][0]))return!0;return!1}if("GeometryCollection"===e.type&&jsonOdm.util.isArray(e.geometries)){for(o=0;o<e.geometries.length;o++)if(jsonOdm.Geo.MultiPolygon.intersects(t,e.geometries[o]))return!0;return!1}for(o=0;o<t.coordinates.length;o++)for(n=0;n<t.coordinates[o][0].length-1;n++)if(jsonOdm.Geo.edgeIntersectsBounds([t.coordinates[o][0][n],t.coordinates[o][0][n+1]],e))return!0;return!1},jsonOdm.Geo.GeometryCollection=function(t,e){this.type="GeometryCollection",this.geometries=t,e&&(this.bbox=e)},jsonOdm.Geo.GeometryCollection.within=function(t,e){if(!jsonOdm.util.isArray(t.geometries)||!t.geometries.length||!e.type)return!1;for(var o=0;o<t.geometries.length;o++){if(!jsonOdm.Geo[t.geometries[o].type]||!jsonOdm.Geo[t.geometries[o].type].within)return!1;if(!jsonOdm.Geo[t.geometries[o].type].within(t.geometries[o],e))return!1}return!0},jsonOdm.Geo.GeometryCollection.intersects=function(t,e){if(!jsonOdm.util.isArray(t.geometries)||!t.geometries.length||!e.type)return!1;for(var o=0;o<t.geometries.length;o++)if(jsonOdm.Geo[t.geometries[o].type]&&jsonOdm.Geo[t.geometries[o].type].intersects&&jsonOdm.Geo[t.geometries[o].type].intersects(t.geometries[o],e))return!0;return!1},jsonOdm.Geo.pointWithinPolygon=function(t,e){if(!(jsonOdm.util.isArray(t)&&jsonOdm.util.isArray(e)&&e.length>2))return!1;var o,n=0;e[0][0]===e[e.length-1][0]&&e[0][1]===e[e.length-1][1]||(e=e.concat([e[0]]));for(var r=0;r<e.length-1;r++){if(e[r][0]===t[0]&&e[r][1]===t[1])return!0;if(!(e[r][0]<t[0]&&e[r+1][0]<t[0]||e[r][1]<t[1]&&e[r+1][1]<t[1]||e[r][1]>t[1]&&e[r+1][1]>t[1])){if(o=(e[r][0]-e[r+1][0])*((t[1]-e[r+1][1])/(e[r][1]-e[r+1][1]))+e[r+1][0],o===t[0]&&t[1]<=Math.max(e[r][1],e[r+1][1])&&t[1]>=Math.min(e[r][1],e[r+1][1]))return!0;o>t[0]&&n++}}return n%2===1},jsonOdm.Geo.edgeWithinPolygon=function(t,e){if(!(jsonOdm.util.isArray(t)&&2===t.length&&jsonOdm.util.isArray(e)&&e.length>=2))return!1;if(e[0][0]===e[e.length-1][0]&&e[0][1]===e[e.length-1][1]||(e=e.concat([e[0]])),!jsonOdm.Geo.pointWithinPolygon(t[0],e)||!jsonOdm.Geo.pointWithinPolygon(t[1],e))return!1;for(var o=0;o<e.length-1;o++)if(jsonOdm.Geo.edgeIntersectsEdge(t,[e[o],e[o+1]],!1))return!1;return!0},jsonOdm.Geo.edgeIntersectsPolygon=function(t,e){if(!(jsonOdm.util.isArray(t)&&2===t.length&&jsonOdm.util.isArray(e)&&e.length>=2))return!1;if(e[0][0]===e[e.length-1][0]&&e[0][1]===e[e.length-1][1]||(e=e.concat([e[0]])),jsonOdm.Geo.pointWithinPolygon(t[0],e)||jsonOdm.Geo.pointWithinPolygon(t[1],e))return!0;for(var o=0;o<e.length-1;o++)if(jsonOdm.Geo.edgeIntersectsEdge(t,[e[o],e[o+1]]))return!0;return!1},jsonOdm.Geo.edgeIntersectsLineString=function(t,e){if(!jsonOdm.util.isArray(t)||2!==t.length||!jsonOdm.util.isArray(e))return!1;for(var o=0;o<e.length-1;o++)if(jsonOdm.Geo.edgeIntersectsEdge(t,[e[o],e[o+1]]))return!0;return!1},jsonOdm.Geo.edgeIntersectsEdge=function(t,e,o){o="undefined"==typeof o||o;var n=[t[1][0]-t[0][0],t[1][1]-t[0][1]],r=[Math.min(t[0][0],t[1][0]),Math.min(t[0][1],t[1][1]),Math.max(t[0][0],t[1][0]),Math.max(t[0][1],t[1][1])],i=[e[1][0]-e[0][0],e[1][1]-e[0][1]],s=[Math.min(e[0][0],e[1][0]),Math.min(e[0][1],e[1][1]),Math.max(e[0][0],e[1][0]),Math.max(e[0][1],e[1][1])];if(r[0]>s[0]&&r[0]>s[2]||r[1]>s[1]&&r[1]>s[3]||s[0]>r[0]&&s[0]>r[2]||s[1]>r[1]&&s[1]>r[3])return!1;if(i[0]*n[1]-n[0]*i[1]===0)return o&&t[0][1]+(e[0][0]-t[0][0])/n[0]*n[1]===e[0][1];var u=(e[0][1]*i[0]+t[0][0]*i[1]-e[0][0]*i[1]-t[0][1]*i[0])/(n[1]*i[0]-n[0]*i[1]),d=t[0][0]+u*n[0],c=t[0][1]+u*n[1];return o?d>=r[0]&&d<=r[2]&&c>=r[1]&&c<=r[3]&&d>=s[0]&&d<=s[2]&&c>=s[1]&&c<=s[3]:d>r[0]&&d<r[2]&&c>r[1]&&c<r[3]&&d>s[0]&&d<s[2]&&c>s[1]&&c<s[3]},jsonOdm.Geo.pointWithinLineString=function(t,e){if(!(jsonOdm.util.isArray(t)&&jsonOdm.util.isArray(e)&&e.length>=2))return!1;for(var o=0;o<e.length-1;o++)if((t[0]>=e[o][0]&&t[0]<=e[o+1][0]&&e[o][0]<=e[o+1][0]||t[0]<=e[o][0]&&t[0]>=e[o+1][0]&&e[o][0]>=e[o+1][0])&&(t[1]>=e[o][1]&&t[1]<=e[o+1][1]&&e[o][1]<=e[o+1][1]||t[1]<=e[o][1]&&t[1]>=e[o+1][1]&&e[o][1]>=e[o+1][1])&&(e[o][0]===t[0]&&e[o][1]===t[1]||e[o+1][0]===t[0]&&e[o+1][1]===t[1]||e[o][1]-e[o+1][1]!=0&&(e[o][0]-e[o+1][0])*((t[1]-e[o+1][1])/(e[o][1]-e[o+1][1]))+e[o+1][0]===t[0]||e[o][0]-e[o+1][0]!=0&&(e[o][1]-e[o+1][1])*((t[0]-e[o+1][0])/(e[o][0]-e[o+1][0]))+e[o+1][1]===t[1]))return!0;return!1},jsonOdm.Geo.pointWithinBounds=function(t,e){return!(!jsonOdm.util.isArray(t)||!jsonOdm.util.isArray(e)||4!==e.length)&&(t[0]>=e[0]&&t[1]>=e[1]&&t[0]<=e[2]&&t[1]<=e[3])},jsonOdm.Geo.edgeIntersectsBounds=function(t,e){return!(!jsonOdm.util.isArray(t)||!jsonOdm.util.isArray(e)||4!==e.length)&&jsonOdm.Geo.edgeIntersectsPolygon(t,[[e[0],e[1]],[e[2],e[1]],[e[2],e[3]],[e[0],e[3]]])},jsonOdm.Geo.lineStringWithinLineString=function(t,e){if(!jsonOdm.util.isArray(t)||!jsonOdm.util.isArray(e))return!1;var o,n;for(o=0;t&&o<t.length;o++){var r=!1;for(n=0;e&&n<e.length;n++)if(t[o][0]===e[n][0]&&t[o][1]===e[n][1]){if(o+1===t.length)return!0;if(!(e[n+1]&&t[o+1][0]===e[n+1][0]&&t[o+1][1]===e[n+1][1]||t[o+1][0]===e[n][0]&&t[o+1][1]===e[n][1]||n>0&&t[o+1][0]===e[n-1][0]&&t[o+1][1]===e[n-1][1]))return!1;r=!0}if(!r)return!1}return!0},"undefined"==typeof jsonOdm)var jsonOdm=new JsonOdm;if(jsonOdm.Collection=function(t){var e=Object.create(Array.prototype);return e=Array.apply(e)||e,"undefined"!=typeof t&&jsonOdm.selectedSource&&jsonOdm.selectedSource[t]&&(e=e.concat(jsonOdm.selectedSource[t])),jsonOdm.Collection.decorate(e),e.$branch=function(){var t=jsonOdm.util.branch(e,arguments);return jsonOdm.Collection.decorate(t),t},e},jsonOdm.Collection.decorate=function(t){var e=function(t){jsonOdm.util.isArray(t)&&(t.$hasMany=function(e,o,n,r){"string"==typeof n&&(r=r||n);var i=n;"string"==typeof n&&jsonOdm.selectedSource&&jsonOdm.selectedSource[n]&&(i=jsonOdm.selectedSource[n]);for(var s=0;s<t.length;s++){var u=e;if(t[s].hasOwnProperty(e)&&(u=t[s][e]),"undefined"==typeof t[s][r])for(var d=0;u.length&&d<u.length;d++){for(var c=null,l=0;l<i.length;l++)if(u[d]==i[l][o]){c=i[l];break}null!=c&&(t[s][r]||(t[s][r]=[]),t[s][r].push(c))}}},t.$hasOne=function(e,o,n,r){"string"==typeof n&&(r=r||n);var i=n;"string"==typeof n&&jsonOdm.selectedSource&&jsonOdm.selectedSource[n]&&(i=jsonOdm.selectedSource[n]);for(var s=0;s<t.length;s++){var u;if(t[s].hasOwnProperty(e)&&(u=t[s][e]),"undefined"==typeof t[s][r]){for(var d=null,c=0;c<i.length;c++)if(u==i[c][o]){d=i[c];break}null!=d&&(t[s][r]=d)}}},t.$query=function(){return new jsonOdm.Query(t)})};e(t)},"undefined"==typeof jsonOdm)var jsonOdm=new JsonOdm;jsonOdm.Query=function(t){this.$$commandQueue=[],this.$$aggregationBeforeCollectQueue=[],this.$$aggregationResultQueue=[],this.$$collection=t||[],this.$$accumulation=!1},jsonOdm.Query.prototype.$delete=function(){if(this.$$commandQueue.length<1)return this;for(var t=0;t<this.$$collection.length;){for(var e=!0,o=0;o<this.$$commandQueue.length&&(e=e&&this.$$commandQueue[o](this.$$collection[t]));o++);e?this.$$collection.splice(t,1):t++}return this},jsonOdm.Query.prototype.$result=function(t,e){if(this.$$commandQueue.length<1&&this.$$aggregationBeforeCollectQueue<1)return this.$$collection;t="undefined"==typeof t?0:t,e="undefined"==typeof e?this.$$collection.length:e;var o,n,r,i=new jsonOdm.Collection;for(n=0;n<this.$$collection.length;n++){var s=!0;for(r=0;r<this.$$commandQueue.length;r++){var u=this.$$commandQueue[r](this.$$collection[n]);if(!(s=s&&null!==u&&u!==!1&&"undefined"!=typeof u))break}if(s){if(t>0){t--;continue}if(e<=0)return i;for(o=this.$$collection[n],r=0;r<this.$$aggregationBeforeCollectQueue.length;r++)o=this.$$aggregationBeforeCollectQueue[r](n,o);i.push(o),e--}}for(n=0;n<this.$$aggregationResultQueue.length;n++)i=this.$$aggregationResultQueue[n](i);return i},jsonOdm.Query.prototype.$all=function(){return this.$result()},jsonOdm.Query.prototype.$first=function(){return this.$result(0,1)[0]},jsonOdm.Query.prototype.$aggregateCollection=function(t,e,o){return"function"==typeof t&&(t=[t]),"function"==typeof e&&(e=[e]),"function"==typeof o&&(o=[o]),jsonOdm.util.isArray(t)&&(this.$$commandQueue=this.$$commandQueue.concat(t)),jsonOdm.util.isArray(e)&&(this.$$aggregationBeforeCollectQueue=this.$$aggregationBeforeCollectQueue.concat(e)),jsonOdm.util.isArray(o)&&(this.$$aggregationResultQueue=this.$$aggregationResultQueue.concat(o)),this},jsonOdm.Query.prototype.$group=function(){var t=arguments,e=!1,o=[];return arguments.length>1&&!jsonOdm.util.isArray(arguments[arguments.length-1])&&!jsonOdm.util.is(arguments[arguments.length-1],"string")&&"object"==typeof arguments[arguments.length-1]&&(e=arguments[arguments.length-1],t=Array.prototype.slice.call(arguments,0,arguments.length-1)),this.$aggregateCollection(function(t,e){var o={};return function(n){for(var r,i={},s=o,u=0;u<t.length;u++){var d=jsonOdm.util.isArray(t[u])?t[u]:[t[u]];r=jsonOdm.util.branch(n,d),u<t.length-1&&("undefined"==typeof s[""+r]&&(s[""+r]={}),s=s[""+r]);for(var c=i,l=0;l<d.length-1;l++)"undefined"==typeof c[d[l]]&&(c[d[l]]={}),c=c[d[l]];c[d[d.length-1]]=r}return s[""+r]||(s[""+r]={accumulationObject:i,subResultSet:[]},e.push(s[""+r])),s[""+r].subResultSet.push(n),!0}}(t,o),null,function(t,e){function o(t){for(var e in t)t.hasOwnProperty(e)&&(t[e]instanceof jsonOdm.Query&&(t[e].$$accumulation=!1),"object"==typeof t[e]&&o(t[e]))}return function(){for(var n=new jsonOdm.Collection,r=0;r<t.length;r++)if(e===!1)n.push(t[r].accumulationObject);else{o(e);for(var i={},s=0;s<t[r].subResultSet.length;s++)i=jsonOdm.util.projectElement(e,t[r].subResultSet[s]);for(s in t[r].accumulationObject)t[r].accumulationObject.hasOwnProperty(s)&&(i[s]=t[r].accumulationObject[s]);n.push(i)}return n}}(o,e))},jsonOdm.Query.prototype.$project=function(t){return this.$aggregateCollection(null,function(e,o){return jsonOdm.util.projectElement(t,o)})},jsonOdm.Query.prototype.$testCollection=function(t,e){var o=this.$$commandQueue.pop(),n=function(){return function(n){if(!(o instanceof jsonOdm.Collection||"function"==typeof o||"undefined"==typeof o)||"function"!=typeof e)return!1;var r="undefined"==typeof o?n:o instanceof jsonOdm.Collection?o:o(n);return!!e(r,t)}}();return this.$$commandQueue.push(n),this},jsonOdm.Query.prototype.$queryOperator=function(t,e){var o=function(t,e){return function(o){if("function"!=typeof e)return!1;for(var n=[],r=0;r<t.length;r++)if(t[r]instanceof jsonOdm.Query)for(var i=0;i<t[r].$$commandQueue.length;i++)n.push(t[r].$$commandQueue[i](o));else n.push(t[r]);return e(n)}}(t,e),n=new jsonOdm.Query(this.$$collection);return n.$$commandQueue.push(o),n},jsonOdm.Query.prototype.$branch=function(t){if("undefined"==typeof t)return this;var e=function(t){return function(e){return jsonOdm.util.branch(e,t)}}(arguments),o=new jsonOdm.Query(this.$$collection);return o.$$commandQueue.push(e),o},jsonOdm.Query.prototype.$modifyField=function(t){var e=function(t,e){return function(o){return o=null!==e?e(o):o,"function"==typeof t?t(o):o}}(t,this.$$commandQueue.length?this.$$commandQueue[this.$$commandQueue.length-1]:null);return this.$$commandQueue.push(e),this},jsonOdm.Query.stringFiledModifyer=["charAt","charCodeAt","concat","fromCharCode","indexOf","lastIndexOf","localeCompare","match","replace","search","slice","split","substr","substring","toLocaleLowerCase","toLocaleUpperCase","toLowerCase","toUpperCase","trim","valueOf"];for(var i=0;i<jsonOdm.Query.stringFiledModifyer.length;i++)jsonOdm.Query.prototype["$"+jsonOdm.Query.stringFiledModifyer[i]]=createQueryStringModifier(jsonOdm.Query.stringFiledModifyer[i]);jsonOdm.Query.prototype.$accumulator=function(t,e){t="string"==typeof t?[t]:t;var o=new jsonOdm.Query(this.$$collection),n=function(t,e,o,n){return function(r){var i=null!==t?jsonOdm.util.branch(r,t):t;return o.$$accumulation=e(i,o.$$accumulation,r),n.$$accumulation=o.$$accumulation,i}}(t,e,o,this);return o.$$commandQueue.push(n),o},jsonOdm.Query.prototype.$sum=function(t){return this.$accumulator(t,function(t,e){return e===!1&&(e=0),t+e})},jsonOdm.Query.prototype.$avg=function(t){var e,o;return this.$accumulator(t,function(t,n){return n===!1&&(e=0,o=0),o+=t,e++,o/e})},jsonOdm.Query.prototype.$max=function(t){return this.$accumulator(t,function(t,e){return e===!1&&(e=t),Math.max(t,e)})},jsonOdm.Query.prototype.$min=function(t){return this.$accumulator(t,function(t,e){return e===!1&&(e=t),Math.min(t,e)})},jsonOdm.Query.prototype.$count=function(){return this.$accumulator(null,function(t,e){return e===!1&&(e=0),++e})},jsonOdm.Query.prototype.$push=function(){var t=new jsonOdm.Query(this.$$collection),e=function(t,e){return function(o){return t.$$accumulation=t.$$accumulation===!1?[]:t.$$accumulation,t.$$accumulation.push(o),e.$$accumulation=t.$$accumulation,!0}}(t,this);return t.$$commandQueue.push(e),t},jsonOdm.Query.prototype.$add=function(t,e){return this.$queryOperator(arguments,function(t){for(var e=t.length>0?t[0]:0,o=1;o<t.length;o++)e+=t[o];return e})},jsonOdm.Query.prototype.$subtract=function(t){return"undefined"==typeof t?this:this.$queryOperator(arguments,function(t){for(var e=t.length>0?t[0]:0,o=1;o<t.length;o++)e-=t[o];return e})},jsonOdm.Query.prototype.$multiply=function(t){return"undefined"==typeof t?this:this.$queryOperator(arguments,function(t){for(var e=t.length>0?t[0]:0,o=1;o<t.length;o++)e*=t[o];return e})},jsonOdm.Query.prototype.$divide=function(t){
return"undefined"==typeof t?this:this.$queryOperator(arguments,function(t){for(var e=t.length>0?t[0]:0,o=1;o<t.length;o++)e/=t[o];return e})},jsonOdm.Query.prototype.$modulo=function(t,e){return"undefined"==typeof t?this:this.$queryOperator(arguments,function(t){for(var e=t.length>0?t[0]:0,o=1;o<t.length;o++)e%=t[o];return e})},jsonOdm.Query.prototype.$eq=function(t){return"undefined"==typeof t?this:this.$testCollection(arguments,function(t,e){for(var o=0;o<e.length;o++)if(e[o]===t)return!0;return!1})},jsonOdm.Query.prototype.$in=function(t){return"undefined"==typeof t&&(t=[]),this.$testCollection(t,function(t,e){for(var o=0;o<e.length;o++)if(e[o]===t)return!0;return!1})},jsonOdm.Query.prototype.$ne=function(t){return"undefined"==typeof t?this:this.$testCollection(arguments,function(t,e){for(var o=0;o<e.length;o++)if(e[o]===t)return!1;return!0})},jsonOdm.Query.prototype.$nin=function(t){return"undefined"==typeof t&&(t=[]),this.$testCollection(t,function(t,e){for(var o=0;o<e.length;o++)if(e[o]===t)return!1;return!0})},jsonOdm.Query.prototype.$gt=function(t){return this.$testCollection(t,function(t,e){return e<t})},jsonOdm.Query.prototype.$gte=function(t){return this.$testCollection(t,function(t,e){return e<=t})},jsonOdm.Query.prototype.$lt=function(t){return this.$testCollection(t,function(t,e){return e>t})},jsonOdm.Query.prototype.$lte=function(t){return this.$testCollection(t,function(t,e){return e>=t})},jsonOdm.Query.prototype.$isNull=function(){return this.$testCollection(null,function(t){return"undefined"==typeof t||null===t})},jsonOdm.Query.prototype.$exists=function(){return this.$testCollection(null,function(t){return"undefined"!=typeof t})},jsonOdm.Query.prototype.$type=function(t){return"undefined"==typeof t?this.$testCollection([t],function(){return!1}):this.$testCollection(arguments,function(t,e){return jsonOdm.util.is(t,e)})},jsonOdm.Query.prototype.$mod=function(t,e){return"undefined"==typeof t||"undefined"==typeof e?this:this.$testCollection(arguments,function(t,e){return t%e[0]===e[1]})},jsonOdm.Query.prototype.$regex=function(t,e){return"string"==typeof t&&(t="string"==typeof e?new RegExp(t,e):new RegExp(t)),this.$testCollection(t,function(t,e){return e.test(t)})},jsonOdm.Query.prototype.$text=function(t){for(var e,o,n=/(^| )-([^ ]+)( |$)/g,r=/"([^"]+)"/g,i=[],s=[];null!==(e=n.exec(t));)i.push(e[2]);for(t=t.replace(n,"");null!==(o=r.exec(t));)s.push(o[1]);t=t.replace(r,"");var u=t.split(" ");return this.$testCollection([i,s,u],function(t,e){for(var o=0;o<e[0].length;o++)if(t.indexOf(e[0][o])>-1)return!1;for(o=0;o<e[1].length;o++)if(t.indexOf(e[1][o])<0)return!1;for(o=0;o<e[2].length;o++)if(t.indexOf(e[2][o])>-1)return!0;return!!e[1].length})},jsonOdm.Query.prototype.$where=function(t){return this.$testCollection(t,function(t,e){return"function"==typeof e&&e.apply(t)})},jsonOdm.Query.prototype.$geoWithin=function(t){return this.$testCollection(jsonOdm.Geo.detectAsGeometry(t),function(t,e){return jsonOdm.Geo[t.type]&&jsonOdm.Geo[t.type].within&&jsonOdm.Geo[t.type].within(t,e)})},jsonOdm.Query.prototype.$geoIntersects=function(t){return this.$testCollection(jsonOdm.Geo.detectAsGeometry(t),function(t,e){return jsonOdm.Geo[t.type]&&jsonOdm.Geo[t.type].intersects&&jsonOdm.Geo[t.type].intersects(t,e)})},jsonOdm.Query.prototype.$and=function(t){return this.$queryOperator(arguments,function(t){for(var e=0;e<t.length;e++)if(!t[e])return!1;return!0})},jsonOdm.Query.prototype.$nand=function(t){return this.$queryOperator(arguments,function(t){for(var e=0;e<t.length;e++)if(!t[e])return!0;return!1})},jsonOdm.Query.prototype.$not=jsonOdm.Query.prototype.$nand,jsonOdm.Query.prototype.$or=function(t){return this.$queryOperator(arguments,function(t){for(var e=0;e<t.length;e++)if(t[e])return!0;return!1})},jsonOdm.Query.prototype.$nor=function(t){return this.$queryOperator(arguments,function(t){for(var e=0;e<t.length;e++)if(t[e])return!1;return!0})};
"use strict";
var gulp = require('gulp'),
jsdoc = require("gulp-jsdoc"),
concat = require('gulp-concat'),
filesize = require('gulp-filesize'),
bench = require('gulp-bench'),
karma = require('gulp-karma'),
uglify = require('gulp-uglify');
var gulp = require("gulp"),
jsdoc = require("gulp-jsdoc3"),
concat = require("gulp-concat"),
bench = require("gulp-bench"),
karmaServer = require('karma').Server,
uglify = require("gulp-uglify");
var testNonMinifiedFiles = [
'src/odm.js',
'src/util.js',
'src/*.js',
'test/**/*.js'
];
var testMinifiedFiles = [
'bin/*.js',
'test/**/*.js'
];
gulp
.task('default', ['test-minified','doc'] ,function () {})
.task('build',['build-non-minified','test-non-minified'], function() {
return gulp.src(['./bin/json.odm.js'])
.pipe(filesize())
.pipe(concat('json.odm.min.js'))
.task("default", ["test-minified","doc"] ,function () {})
.task("build",["build-non-minified","test-non-minified"], function() {
return gulp.src(["./bin/json.odm.js"])
.pipe(concat("json.odm.min.js"))
.pipe(uglify())
.pipe(filesize())
.pipe(gulp.dest('./bin/')
.pipe(gulp.dest("./bin/")
);
})
.task('build-non-minified', function() {
return gulp.src(['./src/odm.js', './src/util.js', './src/geo.js', './src/collection.js', './src/query.js'])
.pipe(filesize())
.pipe(concat('json.odm.js'))
.pipe(filesize())
.pipe(gulp.dest('./bin/')
.task("build-non-minified", function() {
return gulp.src(["./src/odm.js", "./src/util.js", "./src/geo.js", "./src/collection.js", "./src/query.js"])
.pipe(concat("json.odm.js"))
.pipe(gulp.dest("./bin/")
);
})
.task('test-non-minified', function () {
return gulp.src(testNonMinifiedFiles)
.pipe(karma({
configFile: 'karma.conf.js',
action: 'run'
}))
.on('error', function(err) {
// Make sure failed tests cause gulp to exit non-zero
throw err;
});
.task("test-non-minified", function (done) {
new karmaServer({
configFile: __dirname + "/karma.conf.js",
singleRun: true
}, done).start();
})
.task('test-minified', ['build'], function () {
return gulp.src(testMinifiedFiles)
.pipe(karma({
configFile: 'karma.conf.js',
action: 'run'
}))
.on('error', function(err) {
// Make sure failed tests cause gulp to exit non-zero
throw err;
});
.task("test-minified", ["build"], function (done) {
new karmaServer({
configFile: __dirname + "/karma.conf.min.js",
singleRun: true
}, done).start();
})
.task('doc', function () {
return gulp.src(['./src/*.js'])
.pipe(jsdoc.parser({
name:"jsonOdm",
description:"A light weight but fast object document mapper for JavaScript objects.",
version:"0.2.1"
}, "jsonOdm"))
.pipe(jsdoc.generator('./doc',
{
path: './node_modules/jsdoc3-bootstrap'
})
);
.task("doc", function () {
return gulp.src(["./src/*.js"])
.pipe(jsdoc());
})
.task('bench', function () {
return gulp.src('./bench/*.js', {read: false})
.task("bench", function () {
return gulp.src("./bench/*.js", {read: false})
.pipe(bench())
.pipe(gulp.dest('./doc/bench/')); /* writes a results file to current folder */
.pipe(gulp.dest("./docs/bench/")); /* writes a results file to current folder */
});

@@ -8,7 +8,7 @@ // Karma configuration

// base path that will be used to resolve all patterns (eg. files, exclude)
basePath: '',
basePath: "",
// frameworks to use
// available frameworks: https://npmjs.org/browse/keyword/karma-adapter
frameworks: ['jasmine'],
frameworks: ["jasmine"],

@@ -20,3 +20,3 @@ // list of files / patterns to load in the browser

"src/*.js",
'test/**/*.js'
"test/**/*.js"
],

@@ -27,16 +27,16 @@

preprocessors: {
'src/**/*.js': ['coverage']
"src/**/*.js": ["coverage"]
},
// test results reporter to use
// possible values: 'dots', 'progress'
// possible values: "dots", "progress"
// available reporters: https://npmjs.org/browse/keyword/karma-reporter
reporters: ['progress','coverage'],
reporters: ["progress","coverage"],
coverageReporter: {
dir: './',
dir: "./docs/coverage/",
reporters: [
// reporters not supporting the `file` property
{ type: 'html', subdir: 'doc/coverage/report-html' },
{ type: 'lcovonly',subdir: '/', file: 'lcov.info' }
{ type: "html", subdir: "report-html" },
{ type: "lcovonly",subdir: "lcov", file: "lcov.info" }
]

@@ -64,3 +64,3 @@ },

// available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
browsers: ['PhantomJS'],
browsers: ["PhantomJS"],

@@ -67,0 +67,0 @@ phantomjsLauncher: {

{
"name": "json-odm",
"version": "0.2.1",
"version": "0.2.2",
"description": "Object document mapper for JSON data that provides mongodb methods for querying and transformation as well as additional joining that is not provided by mongodb. >> IF YOU LIKE IT, PLEASE GIVE IT A STAR ON GITHUB <<",

@@ -14,21 +14,21 @@ "main": " ./bin/json.odm.min.js",

"devDependencies": {
"gulp": "^3.8.11",
"codeclimate-test-reporter": "^0.3.3",
"gulp": "^3.9.1",
"gulp-bench": "^1.1.0",
"gulp-concat": "^2.5.2",
"gulp-concat": "^2.6.0",
"gulp-filesize": "^0.0.6",
"gulp-jsdoc": "^0.1.4",
"gulp-karma": "0.0.4",
"gulp-uglify": "^1.1.0",
"jasmine-core": "^2.3.4",
"gulp-jsdoc": "^0.1.5",
"gulp-jsdoc3": "^0.3.0",
"gulp-uglify": "^1.5.4",
"jasmine-core": "^2.4.1",
"jsdoc3-bootstrap": "^0.15.0",
"karma": "^0.12.35",
"karma-coverage": "^0.3.1",
"karma-jasmine": "^0.3.5",
"karma-phantomjs-launcher": "^0.2.0",
"phantomjs": "^1.9.17"
"karma": "^1.0.0",
"karma-coverage": "^1.0.0",
"karma-jasmine": "^1.0.2",
"karma-phantomjs-launcher": "^1.0.0",
"phantomjs": "^2.1.1"
},
"scripts": {
"build": "gulp build",
"test": "gulp",
"report-win":"set CODECLIMATE_REPO_TOKEN=0d92b7367dd924d8fb4592952f58f375f5ac387610689da3aa3ff5ef20726e41; codeclimate-test-reporter < bin/coverage/lcov.info"
"test": "gulp"
},

@@ -35,0 +35,0 @@ "repository": {

[![Build Status](https://travis-ci.org/konsultaner/jsonOdm.svg?branch=master)](https://travis-ci.org/konsultaner/jsonOdm)
[![Code Climate](https://codeclimate.com/github/konsultaner/jsonOdm/badges/gpa.svg)](https://codeclimate.com/github/konsultaner/jsonOdm)
[![Test Coverage](https://codeclimate.com/github/konsultaner/jsonOdm/badges/coverage.svg)](https://codeclimate.com/github/konsultaner/jsonOdm/coverage)
[![npm](https://img.shields.io/npm/dm/json-odm.svg)](https://www.npmjs.com/package/json-odm)

@@ -18,3 +19,5 @@ [![npm](https://img.shields.io/npm/v/json-odm.svg)](https://www.npmjs.com/package/json-odm)

The original use case was an [ionic](http://ionicframework.com) app that was not interactive so providing a server backend was not needed, but structuring my data
into joinable collections seemed very helpful.
into joinable collections seemed very helpful.
And if you can use a server you may consider our new [WebSocket server project "connectanum"](http://www.connectanum.com) for Publish/Subscribe and RPC communication

@@ -27,3 +30,3 @@ If you like the project please support it with a star here on [GitHub](https://github.com/konsultaner/jsonOdm)

----
You can find the [documentation here](https://rawgit.com/konsultaner/jsonOdm/master/doc/jsonOdm/0.2/index.html) or compiled to the folder [/doc/jsonOdm/0.2/*](https://github.com/konsultaner/jsonOdm/blob/master/doc/jsonOdm/0.2/index.html).
You can find the [documentation here](https://rawgit.com/konsultaner/jsonOdm/master/docs/gen/0.2/index.html) or compiled to the folder [/docs/gen/*](https://github.com/konsultaner/jsonOdm/blob/master/docs/gen/index.html).

@@ -33,16 +36,70 @@ Road map

- Implement query methods from [mongo db](http://docs.mongodb.org/manual/reference/operator/query/)
- Comparison (~~$eq~~,~~$gt~~,~~$gte~~,~~$lt~~,~~$lte~~,~~$ne~~,~~$in~~,~~$nin~~) 100%
- Logical (~~$or~~,~~$and~~,~~$not(= $nand as alias)~~,~~$nor~~) 100%
- Element (~~$exists~~,~~$type~~) 100% (+ $isNull, for is null or undefined)
- Evaluation (~~$mod~~,~~$regex~~,~~$text~~,~~$where~~) 100%
- Geospatial (~~$geoWithin~~,~~$geoIntersects~~,$near,$nearSphere) 50% (maybe have a hard and a soft check -> performance)
- Array ($all,$elementMatch,$size) 0% // i may not implement the first two
- Aggregation
- Pipeline (~~$project~~,$match,$redact,~~$limit~~,~~$skip~~,$unwind,$sort,$geoNear,$out) 30% ($limit and $skip is implemented as $result(skip,limit))
- Grouping (~~$group~~,~~$count~~,~~$sum~~,~~$avg~~,$first,$last,~~$min~~,~~$max~~,~~$push~~,$addToSet) 70% ($count is used to count the results)
- Operators (Boolean,Set,Comparison,~~Arithmetic~~,~~String~~,Array,Date,Conditional,Variable,Grouping) 20% ($mod is renamed $modulo, because Evaluation has a $mod)
- Support Promise/A+ sources for the odm.addSource
- Full CRUD support
- Aggregation
- [ ] Implement query methods from [mongo db](http://docs.mongodb.org/manual/reference/operator/query/)
- [x] Comparison 100%
- [x] $eq
- [x] $gt
- [x] $gte
- [x] $lt
- [x] $lte
- [x] $ne
- [x] $in
- [x] $nin
- [x] Logical 100%
- [x] $or
- [x] $and
- [x] $not(= $nand as alias)
- [x] $nor
- [x] Element 100% (+ $isNull, for is null or undefined)
- [x] $exists
- [x] $type
- [x] Evaluation 100%
- [x] $mod
- [x] $regex
- [x] $text
- [x] $where
- [x] Geospatial 50% (maybe have a hard and a soft check -> performance)
- [x] $geoWithin
- [x] $geoIntersects
- [ ] $near
- [ ] $nearSphere
- [ ] Array 0% i may not implement the first two
- [ ] $all
- [ ] $elementMatch
- [ ] $size
- [ ] Aggregation
- [ ] Pipeline 30% ($limit and $skip is implemented as $result(skip,limit))
- [x] $project
- [ ] $match
- [ ] $redact
- [x] $limit
- [x] $skip
- [ ] $unwind
- [ ] $sort
- [ ] $geoNear
- [ ] $out
- [ ] Grouping 70% ($count is used to count the results)
- [x] $group
- [x] $count
- [x] $sum
- [x] $avg
- [ ] $first
- [ ] $last
- [x] $min
- [x] $max
- [x] $push
- [ ] $addToSet
- [ ] Operators 20% ($mod is renamed $modulo, because Evaluation has a $mod)
- [ ] Boolean
- [ ] Set
- [ ] Comparison
- [x] Arithmetic
- [x] String
- [ ] Array
- [ ] Date
- [ ] Conditional
- [ ] Variable
- [ ] Grouping
- [ ] Support Promise/A+ sources for the odm.addSource
- [ ] Full CRUD support
- [ ] Aggregation

@@ -73,3 +130,3 @@ Install from NPM-Package

------
This is only a basic example. Find a lot more in the [docs](https://rawgit.com/konsultaner/jsonOdm/master/doc/jsonOdm/0.2/index.html), i.e. how to use [$geoWithin](https://rawgit.com/konsultaner/jsonOdm/master/doc/jsonOdm/0.1/jsonOdm.Query.html#$geoWithin)
This is only a basic example. Find a lot more in the [docs](https://rawgit.com/konsultaner/jsonOdm/master/docs/gen/index.html), i.e. how to use [$geoWithin](https://rawgit.com/konsultaner/jsonOdm/master/docs/gen/jsonOdm.Query.html#__geoWithin__anchor)
```html

@@ -76,0 +133,0 @@ <!-- add minified version from https://github.com/konsultaner/jsonOdm/tree/master/bin to the html head -->

@@ -16,7 +16,7 @@ "use strict";

jsonOdm.Collection = function (collectionName) {
var self = Object.create( Array.prototype );
var self = Object.create(Array.prototype);
// calls the constructor of Array
self = (Array.apply(self) || self);
if(typeof collectionName != "undefined" && jsonOdm.selectedSource && jsonOdm.selectedSource[collectionName]){
if (typeof collectionName !== "undefined" && jsonOdm.selectedSource && jsonOdm.selectedSource[collectionName]) {
self = self.concat(jsonOdm.selectedSource[collectionName]);

@@ -27,3 +27,3 @@ }

self.$branch = function () {
var subCollection = jsonOdm.util.branch(self,arguments);
var subCollection = jsonOdm.util.branch(self, arguments);
jsonOdm.Collection.decorate(subCollection);

@@ -41,5 +41,6 @@ return subCollection;

jsonOdm.Collection.decorate = function (collection) {
var decorate = function (collection){
if(jsonOdm.util.isArray(collection)) {
var decorate = function (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

@@ -55,6 +56,6 @@ * @param {Array|String} foreignKeyMapName The name of the field that holds an array of foreign keys

// SET THE ALIAS
if (typeof childCollectionName == "string") alias = alias || childCollectionName;
if (typeof childCollectionName === "string") alias = alias || childCollectionName;
// FIND THE CHILD COLLECTION
var childCollection = childCollectionName;
if (typeof childCollectionName == "string" && jsonOdm.selectedSource && jsonOdm.selectedSource[childCollectionName]){
if (typeof childCollectionName === "string" && jsonOdm.selectedSource && jsonOdm.selectedSource[childCollectionName]) {
childCollection = jsonOdm.selectedSource[childCollectionName];

@@ -65,4 +66,6 @@ }

var foreignKeyMap = foreignKeyMapName;
if (collection[c].hasOwnProperty(foreignKeyMapName)) foreignKeyMap = collection[c][foreignKeyMapName];
if (typeof collection[c][alias] == "undefined") {
if (collection[c].hasOwnProperty(foreignKeyMapName)) {
foreignKeyMap = collection[c][foreignKeyMapName];
}
if (typeof collection[c][alias] === "undefined") {
for (var i = 0; foreignKeyMap.length && i < foreignKeyMap.length; i++) {

@@ -77,3 +80,5 @@ var foreignModel = null;

if (foreignModel != null) {
if (!collection[c][alias])collection[c][alias] = [];
if (!collection[c][alias]) {
collection[c][alias] = [];
}
collection[c][alias].push(foreignModel);

@@ -94,9 +99,14 @@ }

* @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) {
// SET THE ALIAS
if (typeof childCollectionName == "string") alias = alias || childCollectionName;
if (typeof childCollectionName === "string") alias = alias || childCollectionName;
// FIND THE CHILD COLLECTION
var childCollection = childCollectionName;
if (typeof childCollectionName == "string" && jsonOdm.selectedSource && jsonOdm.selectedSource[childCollectionName]){
if (typeof childCollectionName === "string" && jsonOdm.selectedSource && jsonOdm.selectedSource[childCollectionName]) {
childCollection = jsonOdm.selectedSource[childCollectionName];

@@ -107,4 +117,6 @@ }

var foreignKeyValue;
if (collection[c].hasOwnProperty(foreignKey)) foreignKeyValue = collection[c][foreignKey];
if (typeof collection[c][alias] == "undefined") {
if (collection[c].hasOwnProperty(foreignKey)) {
foreignKeyValue = collection[c][foreignKey];
}
if (typeof collection[c][alias] === "undefined") {
var foreignModel = null;

@@ -130,3 +142,3 @@ for (var j = 0; j < childCollection.length; j++) {

*/
collection.$query = function(){
collection.$query = function () {
return new jsonOdm.Query(collection);

@@ -133,0 +145,0 @@ };

@@ -162,6 +162,7 @@ "use strict";

for (i = 0; geometry.coordinates && i < geometry.coordinates.length; i++) {
for (j = 0; geometry.coordinates[i] && j < geometry.coordinates[i].length; j++)
for (j = 0; geometry.coordinates[i] && j < geometry.coordinates[i].length; j++) {
if (geometry.coordinates[i][j][0] === point.coordinates[0] && geometry.coordinates[i][j][1] === point.coordinates[1]) {
return true;
}
}
}

@@ -172,3 +173,3 @@ return false;

// we assume that polygon wholes do not intersect the outer polygon
return jsonOdm.Geo.pointWithinPolygon(point.coordinates, geometry.coordinates ? geometry.coordinates[0] : null)
return jsonOdm.Geo.pointWithinPolygon(point.coordinates, geometry.coordinates ? geometry.coordinates[0] : null);
}

@@ -272,3 +273,5 @@ if (geometry.type === "MultiPolygon") {

}
if (!found) return false;
if (!found) {
return false;
}
}

@@ -499,3 +502,5 @@ return true;

for (i = 0; i < lineString.coordinates.length - 1; i++) {
if (jsonOdm.Geo.edgeIntersectsLineString([lineString.coordinates[i], lineString.coordinates[i + 1]], geometry.coordinates)) return true;
if (jsonOdm.Geo.edgeIntersectsLineString([lineString.coordinates[i], lineString.coordinates[i + 1]], geometry.coordinates)) {
return true;
}
}

@@ -921,3 +926,5 @@ return false;

var inside = jsonOdm.Geo.edgeWithinPolygon([multiPolygon.coordinates[i][0][k], multiPolygon.coordinates[i][0][k + 1]], geometry.coordinates[j][0]);
if (!inside) break;
if (!inside) {
break;
}
if (inside && k + 1 === multiPolygon.coordinates[i][0].length - 1) {

@@ -1110,3 +1117,5 @@ found = true;

// the vector intersects the positive x-axis of the coordinate system normalized to the point
if (foundX > point[0])intersection++;
if (foundX > point[0]) {
intersection++;
}
}

@@ -1251,3 +1260,3 @@ return intersection % 2 === 1; // the normalized x-axis needs to be intersected by a odd amount of intersections

if (
(lineString[i] [0] === point[0] && lineString[i] [1] === point[1]) ||
(lineString[i][0] === point[0] && lineString[i][1] === point[1]) ||
(lineString[i + 1][0] === point[0] && lineString[i + 1][1] === point[1]) ||

@@ -1292,2 +1301,3 @@

/**
* 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

@@ -1315,8 +1325,10 @@ * @param {Array} lineString An array of points, i.e. [[1,1],[1,2],[1,3]]

(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]) ||
// 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])
)
) return false;
) {
return false;
}
found = true;

@@ -1323,0 +1335,0 @@ }

@@ -37,3 +37,3 @@ "use strict";

jsonOdm.Util.prototype.is = function (object, type) {
type = (typeof type == "string") ? [type] : type;
type = (typeof type === "string") ? [type] : type;
var objectType = Object.prototype.toString.call(object);

@@ -43,7 +43,13 @@ objectType = objectType.substring(8, objectType.length - 1).toLowerCase();

var lowerType = type[i].toLowerCase();
if ("array" == lowerType && this.isArray(object)) return true;
if ("array" === lowerType && this.isArray(object)) {
return true;
}
// all object types, i.e. "[object ArrayBuffer]"
if (lowerType === objectType) return true;
if (lowerType === objectType) {
return true;
}
// number string object
if (typeof object === lowerType) return true;
if (typeof object === lowerType) {
return true;
}
}

@@ -53,4 +59,4 @@ return false;

/** Get only the keys of an object
* @method objectKeys
/** Polyfill for Object.keys
* @method objectKeysPolyfill
* @memberof jsonOdm.Util.prototype

@@ -60,40 +66,48 @@ * @param {Object} object The objects to get the keys from

*/
jsonOdm.Util.prototype.objectKeys = Object.keys || (function () {
var hasOwnProperty = Object.prototype.hasOwnProperty,
hasDontEnumBug = !({toString: null}).propertyIsEnumerable('toString'),
dontEnums = [
'toString',
'toLocaleString',
'valueOf',
'hasOwnProperty',
'isPrototypeOf',
'propertyIsEnumerable',
'constructor'
],
dontEnumsLength = dontEnums.length;
jsonOdm.Util.prototype.objectKeysPolyfill = (function () {
var hasOwnProperty = Object.prototype.hasOwnProperty,
hasDontEnumBug = !({toString: null}).propertyIsEnumerable('toString'),
dontEnums = [
"toString",
"toLocaleString",
"valueOf",
"hasOwnProperty",
"isPrototypeOf",
"propertyIsEnumerable",
"constructor"
],
dontEnumsLength = dontEnums.length;
return function (obj) {
if (typeof obj !== 'object' && (typeof obj !== 'function' || obj === null)) {
throw new TypeError('Object.keys called on non-object');
}
return function (obj) {
if (typeof obj !== "object" && (typeof obj !== "function" || obj === null)) {
throw new TypeError("Object.keys called on non-object");
}
var result = [], prop, i;
var result = [], prop, i;
for (prop in obj) {
if (hasOwnProperty.call(obj, prop)) {
result.push(prop);
}
for (prop in obj) {
if (hasOwnProperty.call(obj, prop)) {
result.push(prop);
}
}
if (hasDontEnumBug) {
for (i = 0; i < dontEnumsLength; i++) {
if (hasOwnProperty.call(obj, dontEnums[i])) {
result.push(dontEnums[i]);
}
if (hasDontEnumBug) {
for (i = 0; i < dontEnumsLength; i++) {
if (hasOwnProperty.call(obj, dontEnums[i])) {
result.push(dontEnums[i]);
}
}
return result;
};
}());
}
return result;
};
}());
/** Get only the keys of an object
* @method objectKeys
* @memberof jsonOdm.Util.prototype
* @param {Object} object The objects to get the keys from
* @return {Array} An array of keys
*/
jsonOdm.Util.prototype.objectKeys = Object.keys || jsonOdm.Util.prototype.objectKeysPolyfill;
/** Query an object with a function

@@ -137,3 +151,3 @@ *

jsonOdm.Util.prototype.projectElement = function (projection, element, parentElement) {
var projectionResult = {}, i;
var projectionResult = {};
for (var key in projection) {

@@ -145,3 +159,3 @@ if (!projection.hasOwnProperty(key)) {

projectionResult[key] = element[key]; // might be undefined or raises an error
} else if (typeof projection[key] === 'function') {
} else if (typeof projection[key] === "function") {
projectionResult[key] = projection[key](parentElement || element);

@@ -151,3 +165,3 @@ } else if (projection[key] instanceof jsonOdm.Query) {

if (projection[key].$$accumulation !== false) projectionResult[key] = projection[key].$$accumulation;
} else if (typeof projection[key] === 'object') {
} else if (typeof projection[key] === "object") {
projectionResult[key] = this.projectElement(projection[key], element[key], parentElement || element);

@@ -154,0 +168,0 @@ }

@@ -898,2 +898,12 @@ describe("Collection", function () {

describe("Source Selection", function () {
it("Collection should be empty", function () {
jsonOdm.addSource("empty",{},true);
var collection = new jsonOdm.Collection("parentCollection");
expect(collection.length).toBe(0);
jsonOdm.selectSource("test");
collection = new jsonOdm.Collection("parentCollection");
expect(collection.length).toBe(1);
});
});
describe("Array inheritance", function () {

@@ -1075,2 +1085,8 @@ var collection;

});
it("Should group without projection", function () {
var grouped = q.$group(
"salaryGroupId"
).$all();
expect(grouped.length).toBe(5);
});
it("Should group the collection by fields", function () {

@@ -1077,0 +1093,0 @@ var grouped = q.$group(

@@ -58,2 +58,9 @@ describe("Utilities", function () {

});
it("Should have the key even with the polyfill", function () {
expect(jsonOdm.util.objectKeysPolyfill(myObject)[0]).toBe("myKey");
expect(jsonOdm.util.objectKeysPolyfill(myObject).length).toBe(1);
});
it("Should throw an error for the functions", function () {
expect(function () {jsonOdm.util.objectKeysPolyfill()}).toThrow(new TypeError('Object.keys called on non-object'));
});
});

@@ -60,0 +67,0 @@ describe("Branch", function () {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc