bear-hackathon-ecology
Version:
TypeScript library providing ecological data and lifecycle information for Japanese Black Bears
27 lines (26 loc) • 827 B
JavaScript
import monthlyDataJson from './data/monthly-data.json' assert { type: 'json' };
import cycleDataJson from './data/cycle-data.json' assert { type: 'json' };
export class BearEcology {
constructor() {
this.monthlyData = monthlyDataJson.monthly_data;
this.cycleData = cycleDataJson.cycles;
}
// Get monthly danger data
getMonthData(month) {
return this.monthlyData.find(data => data.month === month);
}
// Get cycle data by ID
getCycleData(cycleId) {
return this.cycleData.find(cycle => cycle.id === cycleId);
}
// Get all monthly data
getAllMonthlyData() {
return this.monthlyData;
}
// Get all cycle data
getAllCycles() {
return this.cycleData;
}
}
// Export a default instance
export const bearEcology = new BearEcology();