Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@giscience/ohsome-js-utils

Package Overview
Dependencies
Maintainers
2
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@giscience/ohsome-js-utils - npm Package Compare versions

Comparing version 0.6.4 to 0.6.5

3

dist/api/v1/response/GroupByResponse.d.ts
import { Response } from './Response';
import { GroupByResponseJSON } from '../format';
import { ResponseJSON } from '../format';
import { GroupByResponseJSON, ResponseJSON } from '../format';
import { GroupByResultItemJSON } from '../format/GroupByResultItemJSON';

@@ -5,0 +4,0 @@ import { GroupByBoundaryRatioResponseJSON } from '../format/GroupByBoundaryRatioResponseJSON';

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

!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("moment")):"function"==typeof define&&define.amd?define(["exports","moment"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).OhsomeJsUtils={},t.moment_)}(this,(function(t,e){"use strict";function s(t){var e=Object.create(null);return t&&Object.keys(t).forEach((function(s){if("default"!==s){var r=Object.getOwnPropertyDescriptor(t,s);Object.defineProperty(e,s,r.get?r:{enumerable:!0,get:function(){return t[s]}})}})),e.default=t,Object.freeze(e)}var r=s(e);const i="\\s*:\\s*",n="\\s*,\\s*",o="(?:[-+]?[0-9]*\\.?[0-9]+(?:[eE][-+]?[0-9]+)?)",a=o+n+o,u="[^:|]+",l="^\\s*"+g(h(u)+i)+"?"+h(h(a)+n+h(a))+"\\s*$",c="^\\s*"+g(h(u)+i)+"?"+h(h(a)+n+h(o))+"\\s*$",p="^\\s*"+g(h(u)+i)+"?"+h(h(a)+g(n+a)+"{2,}"+n+h(a))+"\\s*$";function h(t){return"("+t+")"}function g(t){return"(?:"+t+")"}var m=Object.freeze({__proto__:null,BBOX:l,BCIRCLE:c,BOUNDARY_ID:u,BPOLY:p,COLON_SEP:i,COMMA_SEP:n,FLOAT:o,POINT2D:a,capture:h,group:g});var d=Object.freeze({__proto__:null,UNITS:{"":{units:["","k"],factor:1e3},meter:{units:["m","km"],factor:1e3},m:{units:["m","km"],factor:1e3},"m²":{units:["㎡","㎢"],factor:1e6}},getUnitByMeasure:function(t){let e="";const s={count:"",length:"m",area:"m²",perimeter:"m"};try{e=s[t]}catch(e){throw new TypeError(`${t} has no known unit. ${e}`)}return e},kFormatter:function(t,e){let s=t,r=this.UNITS[e].units[0];const i=this.UNITS[e].factor;let n=1;return t>=i&&(s=t/i,r=this.UNITS[e].units[1]),t>=100*i&&(n=0),s.toFixed(n)+" "+r},percentFormatter:function(t){if(null==t)return"-- %";t*=100;let e=0,s="";if(Math.abs(t)<10){if(e=2,Math.abs(t)<.01&&Math.abs(t)>0)return s=t>0?"< ":"> -",s+"0.01"}else Math.abs(t)<100&&(e=1);return t.toFixed(e)+" %"}}),f=Object.freeze({__proto__:null,RegExpConstants:m,Unit:d});class y{toString(){return null!=this.id&&""!==this.id?this.id+":"+this.geometry:this.geometry}get id(){return this._id}set id(t){this._id=t}get geometry(){return this._geometry}set geometry(t){this._geometry=t}}class x extends y{constructor(){super()}static isBboxString(t){if(null==new RegExp(l,"g").exec(t))return!1;return!0}parse(t){if(t=t.trim(),!x.isBboxString(t))throw new Error(`Unvalid bbox format: ${t}. Should be id:x1,y1,x2,y2 or x1,y1,x2,y2`);const e=new RegExp(l,"g").exec(t);return this.id=e[1],this.geometry=e[2],this}}class b{toParamValue(){return this.boundaries.map((t=>t.toString())).join("|")}toArray(){return this.boundaries}}class B extends y{constructor(){super()}static isBcircleString(t){const e=new RegExp(c,"g").exec(t);if(null==e)return!1;e[3];return parseFloat(e[4])>0}get lng(){return parseFloat(this.geometry.split(",")[0])}get lat(){return parseFloat(this.geometry.split(",")[1])}get radius(){return parseFloat(this.geometry.split(",")[2])}parse(t){if(t=t.trim(),!B.isBcircleString(t))throw new Error(`Unvalid bcircle format: ${t}. Should be id:x1,y1,radius or x1,y1,radius`);const e=new RegExp(c,"g").exec(t);return this.id=e[1],this.geometry=e[2],this}}class R extends y{constructor(){super()}static isBpolyString(t){const e=new RegExp(p,"g").exec(t);if(null==e)return!1;const s=e[3].split(",").map(parseFloat),r=e[4].split(",").map(parseFloat);return s[0]===r[0]&&s[1]===r[1]}parse(t){if(t=t.trim(),!R.isBpolyString(t))throw new Error(`Unvalid bpoly format: ${t}. Should be id:x1,y1,xn-1,yn-1,x1,y1 or x1,y1,xn-1,yn-1,x1,y1`);const e=new RegExp(p,"g").exec(t);return this.id=e[1],this.geometry=e[2],this}}var _=Object.freeze({__proto__:null,Bbox:x,Bboxes:class extends b{constructor(){super(),this.boundaries=[]}static isBboxesString(t){return t.split("|").reduce(((t,e)=>t&&x.isBboxString(e)),!0)}parse(t){const e=t.split("|");return console.log("this.boundaries",this.boundaries),e.forEach((t=>{if(x.isBboxString(t)){const e=(new x).parse(t);this.boundaries.push(e)}}),this),this}},Bcircle:B,Bcircles:class extends b{constructor(){super(),this.boundaries=[]}static isBcirclesString(t){return t.split("|").reduce(((t,e)=>t&&B.isBcircleString(e)),!0)}parse(t){const e=t.split("|");return console.log("this.boundaries",this.boundaries),e.forEach((t=>{if(B.isBcircleString(t)){const e=(new B).parse(t);this.boundaries.push(e)}}),this),this}},Boundaries:b,Boundary:y,Bpoly:R,Bpolys:class extends b{constructor(){super(),this.boundaries=[]}static isBPolysString(t){return t.split("|").reduce(((t,e)=>t&&R.isBpolyString(e)),!0)}parse(t){return t.split("|").forEach((t=>{if(R.isBpolyString(t)){const e=(new R).parse(t);this.boundaries.push(e)}}),this),this}}});class O{constructor(t){this.response=t,this.apiVersion=t.apiVersion,this.attribution=t.attribution,this.metadata=t.metadata}}const S=r;var E=Object.freeze({__proto__:null,GroupByResponse:class extends O{constructor(t){super(t),null!=t.groupByBoundaryResult?this.groupByResult=t.groupByBoundaryResult.map((t=>({groupByObject:t.groupByObject,result:t.ratioResult}))):this.groupByResult=t.groupByResult}static isGroupByResponseJSON(t){return t.groupByResult instanceof Array||t.groupByBoundaryResult instanceof Array}getResult(){return this.groupByResult}toCSV(){let t="";const e=",";let s;t:for(const r of this.groupByResult)for(const i of r.result){s=Object.getOwnPropertyNames(i),t=`groupByObject${e}${s.join(e)}\n`;break t}for(const r of this.groupByResult)for(const i of r.result){t+=[r.groupByObject.includes(e)?`"${r.groupByObject.replace('"','""')}"`:r.groupByObject,...s.map((t=>i[t]))].join(e)+"\n"}return t}},MetadataResponse:class{constructor(t){this.apiVersion=t.apiVersion,this.attribution=t.attribution,this.extractRegion=t.extractRegion}static isMetadataResponseJSON(t){if(!(void 0!==t.apiVersion))return!1;if(!(void 0!==t.attribution))return!1;return void 0!==t.extractRegion}hasTemporalExtent(){return this.extractRegion&&this.extractRegion.temporalExtent&&S(this.extractRegion.temporalExtent.fromTimestamp,S.ISO_8601,!0).isValid()&&S(this.extractRegion.temporalExtent.toTimestamp,S.ISO_8601,!0).isValid()}hasSpatialExtent(){return this.extractRegion&&this.extractRegion.spatialExtent&&("Polygon"==this.extractRegion.spatialExtent.type||"Multipolygon"==this.extractRegion.spatialExtent.type)}},Response:O,SimpleResponse:class extends O{constructor(t){super(t),this.response=t,this.timestamps=null,this.values=null,this.result=t.result}static isSimpleResponseJSON(t){if(!(t.result instanceof Array))return!1;return void 0!==t.result[0].timestamp}getResult(){return this.result}getTimestamps(){return this.timestamps||(this.timestamps=this.result.map((t=>t.timestamp))),this.timestamps}getValues(){return this.values||(this.values=this.result.map((t=>t.value))),this.values}getMaxValue(){return Math.max(...this.getValues())}getMinValue(){return Math.min(...this.getValues())}toCSV(){let t="timestamp,value\n";const e=this.getTimestamps().length;for(let s=0;s<e;s++)t+=this.getTimestamps()[s]+","+this.getValues()[s]+"\n";return t}}}),j=Object.freeze({__proto__:null,format:f,request:_,response:E}),v=Object.freeze({__proto__:null,v1:j});t.OhsomeApi=v}));
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("moment")):"function"==typeof define&&define.amd?define(["exports","moment"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).OhsomeJsUtils={},t.moment_)}(this,(function(t,e){"use strict";function r(t){var e=Object.create(null);return t&&Object.keys(t).forEach((function(r){if("default"!==r){var s=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(e,r,s.get?s:{enumerable:!0,get:function(){return t[r]}})}})),e.default=t,Object.freeze(e)}var s=r(e);const i="\\s*:\\s*",n="\\s*,\\s*",o="(?:[-+]?[0-9]*\\.?[0-9]+(?:[eE][-+]?[0-9]+)?)",a=o+n+o,u="[^:|]+",l="^\\s*"+g(h(u)+i)+"?"+h(h(a)+n+h(a))+"\\s*$",c="^\\s*"+g(h(u)+i)+"?"+h(h(a)+n+h(o))+"\\s*$",p="^\\s*"+g(h(u)+i)+"?"+h(h(a)+g(n+a)+"{2,}"+n+h(a))+"\\s*$";function h(t){return"("+t+")"}function g(t){return"(?:"+t+")"}var m=Object.freeze({__proto__:null,BBOX:l,BCIRCLE:c,BOUNDARY_ID:u,BPOLY:p,COLON_SEP:i,COMMA_SEP:n,FLOAT:o,POINT2D:a,capture:h,group:g});var d=Object.freeze({__proto__:null,UNITS:{"":{units:["","k"],factor:1e3},meter:{units:["m","km"],factor:1e3},m:{units:["m","km"],factor:1e3},"m²":{units:["㎡","㎢"],factor:1e6}},getUnitByMeasure:function(t){let e="";const r={count:"",length:"m",area:"m²",perimeter:"m"};try{e=r[t]}catch(e){throw new TypeError(`${t} has no known unit. ${e}`)}return e},kFormatter:function(t,e){let r=t,s=this.UNITS[e].units[0];const i=this.UNITS[e].factor;let n=1;return t>=i&&(r=t/i,s=this.UNITS[e].units[1]),t>=100*i&&(n=0),r.toFixed(n)+" "+s},percentFormatter:function(t){if(null==t)return"-- %";t*=100;let e=0,r="";if(Math.abs(t)<10){if(e=2,Math.abs(t)<.01&&Math.abs(t)>0)return r=t>0?"< ":"> -",r+"0.01"}else Math.abs(t)<100&&(e=1);return t.toFixed(e)+" %"}}),f=Object.freeze({__proto__:null,RegExpConstants:m,Unit:d});class y{toString(){return null!=this.id&&""!==this.id?this.id+":"+this.geometry:this.geometry}get id(){return this._id}set id(t){this._id=t}get geometry(){return this._geometry}set geometry(t){this._geometry=t}}class x extends y{constructor(){super()}static isBboxString(t){if(null==new RegExp(l,"g").exec(t))return!1;return!0}parse(t){if(t=t.trim(),!x.isBboxString(t))throw new Error(`Unvalid bbox format: ${t}. Should be id:x1,y1,x2,y2 or x1,y1,x2,y2`);const e=new RegExp(l,"g").exec(t);return this.id=e[1],this.geometry=e[2],this}}class b{toParamValue(){return this.boundaries.map((t=>t.toString())).join("|")}toArray(){return this.boundaries}}class B extends y{constructor(){super()}static isBcircleString(t){const e=new RegExp(c,"g").exec(t);if(null==e)return!1;e[3];return parseFloat(e[4])>0}get lng(){return parseFloat(this.geometry.split(",")[0])}get lat(){return parseFloat(this.geometry.split(",")[1])}get radius(){return parseFloat(this.geometry.split(",")[2])}parse(t){if(t=t.trim(),!B.isBcircleString(t))throw new Error(`Unvalid bcircle format: ${t}. Should be id:x1,y1,radius or x1,y1,radius`);const e=new RegExp(c,"g").exec(t);return this.id=e[1],this.geometry=e[2],this}}class R extends y{constructor(){super()}static isBpolyString(t){const e=new RegExp(p,"g").exec(t);if(null==e)return!1;const r=e[3].split(",").map(parseFloat),s=e[4].split(",").map(parseFloat);return r[0]===s[0]&&r[1]===s[1]}parse(t){if(t=t.trim(),!R.isBpolyString(t))throw new Error(`Unvalid bpoly format: ${t}. Should be id:x1,y1,xn-1,yn-1,x1,y1 or x1,y1,xn-1,yn-1,x1,y1`);const e=new RegExp(p,"g").exec(t);return this.id=e[1],this.geometry=e[2],this}}var _=Object.freeze({__proto__:null,Bbox:x,Bboxes:class extends b{constructor(){super(),this.boundaries=[]}static isBboxesString(t){return t.split("|").reduce(((t,e)=>t&&x.isBboxString(e)),!0)}parse(t){const e=t.split("|");return console.log("this.boundaries",this.boundaries),e.forEach((t=>{if(x.isBboxString(t)){const e=(new x).parse(t);this.boundaries.push(e)}}),this),this}},Bcircle:B,Bcircles:class extends b{constructor(){super(),this.boundaries=[]}static isBcirclesString(t){return t.split("|").reduce(((t,e)=>t&&B.isBcircleString(e)),!0)}parse(t){const e=t.split("|");return console.log("this.boundaries",this.boundaries),e.forEach((t=>{if(B.isBcircleString(t)){const e=(new B).parse(t);this.boundaries.push(e)}}),this),this}},Boundaries:b,Boundary:y,Bpoly:R,Bpolys:class extends b{constructor(){super(),this.boundaries=[]}static isBPolysString(t){return t.split("|").reduce(((t,e)=>t&&R.isBpolyString(e)),!0)}parse(t){return t.split("|").forEach((t=>{if(R.isBpolyString(t)){const e=(new R).parse(t);this.boundaries.push(e)}}),this),this}}});class O{constructor(t){this.response=t,this.apiVersion=t.apiVersion,this.attribution=t.attribution,this.metadata=t.metadata}}const S=s;var E=Object.freeze({__proto__:null,GroupByResponse:class extends O{constructor(t){super(t),null!=t.groupByBoundaryResult?this.groupByResult=t.groupByBoundaryResult.map((t=>({groupByObject:t.groupByObject,result:t.ratioResult}))):this.groupByResult=t.groupByResult}static isGroupByResponseJSON(t){return t.groupByResult instanceof Array||t.groupByBoundaryResult instanceof Array}getResult(){return this.groupByResult}toCSV(){let t="";const e=",",r=new RegExp(`${e}|"|\n|\r`);let s;t:for(const r of this.groupByResult)for(const i of r.result){s=Object.getOwnPropertyNames(i),t=`groupByObject${e}${s.join(e)}\n`;break t}for(const i of this.groupByResult)for(const n of i.result){t+=[r.test(i.groupByObject)?`"${i.groupByObject.replace(/"/g,'""')}"`:i.groupByObject,...s.map((t=>n[t]))].join(e)+"\n"}return t}},MetadataResponse:class{constructor(t){this.apiVersion=t.apiVersion,this.attribution=t.attribution,this.extractRegion=t.extractRegion}static isMetadataResponseJSON(t){if(!(void 0!==t.apiVersion))return!1;if(!(void 0!==t.attribution))return!1;return void 0!==t.extractRegion}hasTemporalExtent(){return this.extractRegion&&this.extractRegion.temporalExtent&&S(this.extractRegion.temporalExtent.fromTimestamp,S.ISO_8601,!0).isValid()&&S(this.extractRegion.temporalExtent.toTimestamp,S.ISO_8601,!0).isValid()}hasSpatialExtent(){return this.extractRegion&&this.extractRegion.spatialExtent&&("Polygon"==this.extractRegion.spatialExtent.type||"Multipolygon"==this.extractRegion.spatialExtent.type)}},Response:O,SimpleResponse:class extends O{constructor(t){super(t),this.response=t,this.timestamps=null,this.values=null,this.result=t.result}static isSimpleResponseJSON(t){if(!(t.result instanceof Array))return!1;return void 0!==t.result[0].timestamp}getResult(){return this.result}getTimestamps(){return this.timestamps||(this.timestamps=this.result.map((t=>t.timestamp))),this.timestamps}getValues(){return this.values||(this.values=this.result.map((t=>t.value))),this.values}getMaxValue(){return Math.max(...this.getValues())}getMinValue(){return Math.min(...this.getValues())}toCSV(){let t="timestamp,value\n";const e=this.getTimestamps().length;for(let r=0;r<e;r++)t+=this.getTimestamps()[r]+","+this.getValues()[r]+"\n";return t}}}),j=Object.freeze({__proto__:null,format:f,request:_,response:E}),v=Object.freeze({__proto__:null,v1:j});t.OhsomeApi=v}));
{
"name": "@giscience/ohsome-js-utils",
"version": "0.6.4",
"version": "0.6.5",
"description": "This library contains JavaScript functions to help clients to use the Ohsome-Api for analyzing historical OpenStreetMap data.",

@@ -5,0 +5,0 @@ "license": "Apache-2.0",

Sorry, the diff of this file is not supported yet

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