-
Notifications
You must be signed in to change notification settings - Fork 142
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
17 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,24 @@ | ||
/* Methods that transform STAC object JSON from older versions to | ||
allow for a more consistent usage in other parts of the codebase */ | ||
import { STAC_VERSION } from './config'; | ||
import { STAC_VERSION } from "./config"; | ||
|
||
export const transformCatalog = (entity) => { | ||
if(!entity) { return entity; } | ||
export const transformCatalog = entity => { | ||
if (!entity) { | ||
return entity; | ||
} | ||
|
||
const stacVersion = entity.stac_version || STAC_VERISON; | ||
// Account for the item-assets extension renaming the property used | ||
// in collections from 'assets' to 'item-assets' for STAC 1.0 | ||
if(entity.assets) { | ||
if(stacVersion < "1.0") { | ||
entity.item_assets = entity.assets; | ||
delete entity.assets; | ||
} | ||
const stacVersion = entity.stac_version || STAC_VERSION; | ||
// Account for the item-assets extension renaming the property used | ||
// in collections from 'assets' to 'item-assets' for STAC 1.0 | ||
if (entity.assets) { | ||
if (stacVersion < "1.0") { | ||
entity.item_assets = entity.assets; | ||
delete entity.assets; | ||
} | ||
return entity; | ||
} | ||
return entity; | ||
}; | ||
|
||
export const transformItem = (entity) => { | ||
return entity; | ||
}; | ||
export const transformItem = entity => { | ||
return entity; | ||
}; |