Skip to content

Commit 57fd728

Browse files
committed
Fix outdated README #30
1 parent f9b2c69 commit 57fd728

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

README.md

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,19 @@ Version: **1.3.1**
99
Add to your project with `npm install @radiantearth/stac-fields --save`
1010

1111
Import the utilities to format values:
12+
1213
```js
1314
const StacFields = require('@radiantearth/stac-fields');
1415
```
16+
1517
or
18+
1619
```js
1720
import StacFields from '@radiantearth/stac-fields';
1821
```
1922

2023
Format a value:
24+
2125
```js
2226
let stacItem = {
2327
stac_version: '1.0.0',
@@ -47,12 +51,13 @@ for(let field in stacItem.properties) {
4751

4852
// Option 2: Group by extension and format item properties
4953
// The second parameter is a filter function to skip specific properties or paths, remove to get all properties
50-
let groups = StacFields.formatStacProperties(stacItem, (key, path) => key !== 'eo:bands');
54+
let groups = StacFields.formatItemProperties(stacItem, (key, path) => key !== 'eo:bands');
5155
```
5256

5357
To filter by path (remove all common_name fields from bands):
58+
5459
```js
55-
let groups = StacFields.formatStacProperties(stacItem, (key, path) => !(path[0] === 'eo:bands' && path[2] === 'common_name'));
60+
let groups = StacFields.formatItemProperties(stacItem, (key, path) => !(path[0] === 'eo:bands' && path[2] === 'common_name'));
5661
```
5762

5863
This library is written for the latest version of the STAC specification (1.0.0-rc.4).
@@ -157,11 +162,11 @@ Formatters are always functions that have the following signature:
157162

158163
`method(value : any, field : string, spec : object, context = null, parent = null) => string`
159164

160-
- `value` is the value of the field in the STAC JSON.
161-
- `field` is the key of the field in the STAC JSON.
162-
- `spec` is the normalized object for the field from the `fields.json`.
163-
- `context` is the full STAC JSON.
164-
- `parent` is the parent object, if any.
165+
* `value` is the value of the field in the STAC JSON.
166+
* `field` is the key of the field in the STAC JSON.
167+
* `spec` is the normalized object for the field from the `fields.json`.
168+
* `context` is the full STAC JSON.
169+
* `parent` is the parent object, if any.
165170

166171
The returned value is always expected to be a string.
167172
It may contain HTML if the formatter is added to the `htmlFormats` array in `fields.json`.

0 commit comments

Comments
 (0)