Comparing version 0.0.7 to 0.0.8
{ | ||
"name": "stac-js", | ||
"version": "0.0.7", | ||
"version": "0.0.8", | ||
"description": "JS drop-in classes with utilities for STAC", | ||
@@ -5,0 +5,0 @@ "author": "Matthias Mohr", |
@@ -9,3 +9,3 @@ # stac-js | ||
- **Package version:** 0.0.7 | ||
- **Package version:** 0.0.8 | ||
- **STAC versions:** >= 0.6.0 (through [stac-migrate](https://github.com/stac-utils/stac-migrate)). | ||
@@ -12,0 +12,0 @@ - **Documentation:** <https://m-mohr.github.io/stac-js/latest/> |
@@ -1,3 +0,1 @@ | ||
import { browserProtocols } from "./http.js"; | ||
import { cogMediaTypes, geotiffMediaTypes, isMediaType } from "./mediatypes.js"; | ||
import { getMaxForDataType, getMinForDataType, hasText, isObject, mergeArraysOfObjects } from "./utils.js"; | ||
@@ -317,30 +315,2 @@ import STACReference from './reference.js'; | ||
/** | ||
* Checks whether this asset is of a specific type. | ||
* | ||
* @param {string|Array.<string>} types One or more media types. | ||
* @returns {boolean} `true` is this asset is one of the given types, `false` otherwise. | ||
*/ | ||
isType(types) { // string or array of strings | ||
return hasText(this.type) && isMediaType(this.type, types); | ||
} | ||
/** | ||
* Checks whether this asset is a GeoTiff (including COGs). | ||
* | ||
* @returns {boolean} `true` is this asset is a GeoTiff, `false` otherwise. | ||
*/ | ||
isGeoTIFF() { | ||
return this.isType(geotiffMediaTypes); | ||
} | ||
/** | ||
* Checks whether this asset is a COG (excluding pure GeoTiffs). | ||
* | ||
* @returns {boolean} `true` is this asset is a COG, `false` otherwise. | ||
*/ | ||
isCOG() { | ||
return this.isType(cogMediaTypes); | ||
} | ||
/** | ||
* Checks whether the asset is accessible via HTTP or HTTPS. | ||
@@ -356,5 +326,3 @@ * | ||
} | ||
let uri = this.getAbsoluteUrl(false); | ||
let protocol = uri.protocol().toLowerCase(); | ||
return hasText(protocol) && browserProtocols.includes(protocol); | ||
return super.isHTTP(); | ||
} | ||
@@ -361,0 +329,0 @@ |
import { browserProtocols, toAbsolute } from './http.js'; | ||
import { cogMediaTypes, geotiffMediaTypes, isMediaType } from "./mediatypes.js"; | ||
import { hasText } from './utils.js'; | ||
@@ -86,2 +87,43 @@ import STACObject from './object.js'; | ||
} | ||
/** | ||
* Checks whether this asset is of a specific type. | ||
* | ||
* @param {string|Array.<string>} types One or more media types. | ||
* @returns {boolean} `true` is this asset is one of the given types, `false` otherwise. | ||
*/ | ||
isType(types) { // string or array of strings | ||
return hasText(this.type) && isMediaType(this.type, types); | ||
} | ||
/** | ||
* Checks whether this asset is a GeoTiff (including COGs). | ||
* | ||
* @returns {boolean} `true` is this asset is a GeoTiff, `false` otherwise. | ||
*/ | ||
isGeoTIFF() { | ||
return this.isType(geotiffMediaTypes); | ||
} | ||
/** | ||
* Checks whether this asset is a COG (excluding pure GeoTiffs). | ||
* | ||
* @returns {boolean} `true` is this asset is a COG, `false` otherwise. | ||
*/ | ||
isCOG() { | ||
return this.isType(cogMediaTypes); | ||
} | ||
/** | ||
* Checks whether the asset is accessible via HTTP or HTTPS. | ||
* | ||
* Returns `null` for item asset definitions, otherwise a `boolean` value. | ||
* | ||
* @returns {boolean|null} `true` is this asset is available via HTTP or HTTPS, `false` or `null` otherwise. | ||
*/ | ||
isHTTP() { | ||
let uri = this.getAbsoluteUrl(false); | ||
let protocol = uri.protocol().toLowerCase(); | ||
return hasText(protocol) && browserProtocols.includes(protocol); | ||
} | ||
@@ -88,0 +130,0 @@ } |
78015
2227