diff --git a/geojson.js b/geojson.js index aa6b7e7..308d2a4 100644 --- a/geojson.js +++ b/geojson.js @@ -1,5 +1,5 @@ (function(GeoJSON) { - GeoJSON.version = '0.4.1'; + GeoJSON.version = '0.5.0'; // Allow user to specify default parameters GeoJSON.defaults = { diff --git a/geojson.min.js b/geojson.min.js index b0194b1..715297b 100644 --- a/geojson.min.js +++ b/geojson.min.js @@ -1,3 +1,3 @@ -// geojson.js - v0.4.1 +// geojson.js - v0.5.0 // (c) 2016 Casey Thomas, MIT License -!function(a){function b(){var a=1<=arguments.length?[].slice.call(arguments,0):[],b=a.shift(),c=a.shift();Error.apply(this,a),this.message=this.message||"Invalid Geometry: item: "+JSON.stringify(b)+", params: "+JSON.stringify(c)}function c(a,b){var c=a||{};for(var d in b)b.hasOwnProperty(d)&&!c[d]&&(c[d]=b[d]);return c}function d(a,b){if(b.crs&&e(b.crs)&&(b.isPostgres?a.geometry.crs=b.crs:a.crs=b.crs),b.bbox&&(a.bbox=b.bbox),b.extraGlobal){a.properties={};for(var c in b.extraGlobal)a.properties[c]=b.extraGlobal[c]}}function e(a){if("name"===a.type){if(a.properties&&a.properties.name)return!0;throw new Error('Invalid CRS. Properties must contain "name" key')}if("link"===a.type){if(a.properties&&a.properties.href&&a.properties.type)return!0;throw new Error('Invalid CRS. Properties must contain "href" and "type" key')}throw new Error('Invald CRS. Type attribute must be "name" or "link"')}function f(a){a.geom={};for(var b in a)a.hasOwnProperty(b)&&-1!==m.indexOf(b)&&(a.geom[b]=a[b],delete a[b]);g(a.geom)}function g(a){for(var b in a)a.hasOwnProperty(b)&&("string"==typeof a[b]?n.push(a[b]):"object"==typeof a[b]&&(n.push(a[b][0]),n.push(a[b][1])));if(0===n.length)throw new Error("No geometry attributes specified")}function h(a){var b=a.item,c=a.params,d=a.propFunc,e={type:"Feature"};return e.geometry=j(b,c),e.properties=d.call(b),e}function i(a){return/^.+\..+$/.test(a)}function j(c,d){var e={};for(var f in d.geom){var g=d.geom[f];if("string"==typeof g&&c.hasOwnProperty(g))"GeoJSON"===f?e=c[g]:(e.type=f,e.coordinates=c[g]);else if("object"!=typeof g||Array.isArray(g)){if(Array.isArray(g)&&c.hasOwnProperty(g[0])&&c.hasOwnProperty(g[1]))e.type=f,e.coordinates=[Number(c[g[1]]),Number(c[g[0]])];else if(Array.isArray(g)&&i(g[0])&&i(g[1])){for(var h=[],k=0;k