Skip to content
This repository was archived by the owner on Oct 16, 2020. It is now read-only.

Commit 2996755

Browse files
committed
feat: return options for locate result
1 parent c1dffcb commit 2996755

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

src/locate.js

+8-7
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,17 @@ import locations from '../data/locations.json';
88
* @returns {object} ...
99
*/
1010
function locate(location = {}) {
11+
const options = { forestEcoregion: Object.keys(locations) };
1112
const { forestEcoregion, altitudinalZone } = location;
1213
let ecogram;
13-
if (
14-
locations[forestEcoregion] &&
15-
locations[forestEcoregion][altitudinalZone]
16-
) {
17-
const id = locations[forestEcoregion][altitudinalZone];
18-
ecogram = ecograms[id];
14+
if (locations[forestEcoregion]) {
15+
options.altitudinalZone = Object.keys(locations[forestEcoregion]);
16+
if (locations[forestEcoregion][altitudinalZone]) {
17+
const id = locations[forestEcoregion][altitudinalZone];
18+
ecogram = ecograms[id];
19+
}
1920
}
20-
return { ecogram };
21+
return { ecogram, options };
2122
}
2223

2324
export default locate;

0 commit comments

Comments
 (0)