File tree Expand file tree Collapse file tree 3 files changed +44
-0
lines changed
Expand file tree Collapse file tree 3 files changed +44
-0
lines changed Original file line number Diff line number Diff line change 1+ export const API_ENDPOINTS = {
2+ SEISMIC : '/api/simulate/seismic' ,
3+ TSUNAMI : '/api/simulate/tsunami' ,
4+ HEALTH : '/api/health'
5+ } ;
6+
7+ export const MAP_DEFAULTS = {
8+ CENTER_LAT : 0 ,
9+ CENTER_LON : 0 ,
10+ ZOOM : 2
11+ } ;
12+
13+ export const SIMULATION_LIMITS = {
14+ MAX_MAGNITUDE : 10 ,
15+ MIN_MAGNITUDE : 0 ,
16+ MAX_DEPTH : 1000 ,
17+ MIN_DEPTH : 0
18+ } ;
Original file line number Diff line number Diff line change 1+ export const formatNumber = ( num : number , decimals : number = 2 ) : string => {
2+ return num . toFixed ( decimals ) ;
3+ } ;
4+
5+ export const formatDate = ( date : Date ) : string => {
6+ return date . toLocaleDateString ( 'es-ES' ) ;
7+ } ;
8+
9+ export const formatCoordinates = ( lat : number , lon : number ) : string => {
10+ return `${ formatNumber ( lat ) } °, ${ formatNumber ( lon ) } °` ;
11+ } ;
Original file line number Diff line number Diff line change 1+ export const validateLatitude = ( lat : number ) : boolean => {
2+ return lat >= - 90 && lat <= 90 ;
3+ } ;
4+
5+ export const validateLongitude = ( lon : number ) : boolean => {
6+ return lon >= - 180 && lon <= 180 ;
7+ } ;
8+
9+ export const validateMagnitude = ( mag : number ) : boolean => {
10+ return mag >= 0 && mag <= 10 ;
11+ } ;
12+
13+ export const validateDepth = ( depth : number ) : boolean => {
14+ return depth >= 0 && depth <= 1000 ;
15+ } ;
You can’t perform that action at this time.
0 commit comments