airport-data-js 2.0.0 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +104 -0
- package/README.md +190 -24
- package/dist/airport-data.min.js +1 -1
- package/lib/index.js +1 -1
- package/package.json +15 -9
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
## [Unreleased]
|
|
9
|
+
|
|
10
|
+
### [3.0.0] - 2025-12-05
|
|
11
|
+
|
|
12
|
+
#### 🆕 New Features
|
|
13
|
+
|
|
14
|
+
- **`getAirportStatsByCountry(countryCode)`** - Get comprehensive statistics for airports in a country
|
|
15
|
+
- **`getAirportStatsByContinent(continentCode)`** - Get comprehensive statistics for airports on a continent
|
|
16
|
+
- **`getLargestAirportsByContinent(continentCode, limit, sortBy)`** - Get largest airports by runway or elevation
|
|
17
|
+
- **`getMultipleAirports(codes)`** - Bulk fetch multiple airports in one call
|
|
18
|
+
- **`calculateDistanceMatrix(codes)`** - Calculate distances between all pairs of airports
|
|
19
|
+
- **`findNearestAirport(lat, lon, filters)`** - Find single nearest airport with optional filters
|
|
20
|
+
- **`validateIataCode(code)`** - Validate IATA code existence
|
|
21
|
+
- **`validateIcaoCode(code)`** - Validate ICAO code existence
|
|
22
|
+
- **`getAirportCount(filters)`** - Get count of airports matching filters
|
|
23
|
+
- **`isAirportOperational(code)`** - Check if airport has scheduled service
|
|
24
|
+
|
|
25
|
+
#### 🔄 Improvements
|
|
26
|
+
|
|
27
|
+
- Enhanced bulk operations for better performance
|
|
28
|
+
- Added comprehensive statistical analysis capabilities
|
|
29
|
+
- Improved validation utilities for code checking
|
|
30
|
+
- Better support for route planning and analysis
|
|
31
|
+
- Professional build pipeline with duplicate checking
|
|
32
|
+
- Automated release notes from changelog
|
|
33
|
+
|
|
34
|
+
## [2.0.0] - 2024-07-24
|
|
35
|
+
|
|
36
|
+
### 🆕 New Features
|
|
37
|
+
|
|
38
|
+
- **`getAirportsByTimezone(timezone)`** - Find airports by timezone
|
|
39
|
+
- **`getAirportLinks(code)`** - Get external links for airports
|
|
40
|
+
- **`findAirports(filters)`** - Advanced multi-criteria filtering
|
|
41
|
+
- **`getAutocompleteSuggestions(query)`** - Autocomplete functionality
|
|
42
|
+
- **Enhanced `getAirportsByType(type)`** - Now supports convenience search for "airport" type
|
|
43
|
+
- **External links support** - Wikipedia, websites, and flight tracking URLs
|
|
44
|
+
- **Timezone information** - Complete timezone data for all airports
|
|
45
|
+
- **Runway length data** - Airport runway information included
|
|
46
|
+
- **Scheduled service indicator** - Whether airports have commercial scheduled service
|
|
47
|
+
|
|
48
|
+
### 🔄 Improvements
|
|
49
|
+
|
|
50
|
+
- Better error handling and validation
|
|
51
|
+
- More comprehensive airport data structure
|
|
52
|
+
- Improved type filtering with partial matching
|
|
53
|
+
- Enhanced geographic calculations
|
|
54
|
+
- Case-insensitive search improvements
|
|
55
|
+
|
|
56
|
+
### ❌ Breaking Changes
|
|
57
|
+
|
|
58
|
+
- Legacy data format no longer supported
|
|
59
|
+
- Simplified airport objects expanded to include more fields
|
|
60
|
+
- Basic filtering replaced with advanced `findAirports` function
|
|
61
|
+
|
|
62
|
+
## [1.0.6] - 2022-11-24
|
|
63
|
+
|
|
64
|
+
### 🔄 Improvements
|
|
65
|
+
|
|
66
|
+
- Data updates
|
|
67
|
+
|
|
68
|
+
## [1.0.5] - 2022-11-20
|
|
69
|
+
|
|
70
|
+
### 🔄 Improvements
|
|
71
|
+
|
|
72
|
+
- Data updates
|
|
73
|
+
|
|
74
|
+
## [1.0.4] - 2022-11-18
|
|
75
|
+
|
|
76
|
+
### 🔄 Improvements
|
|
77
|
+
|
|
78
|
+
- Data updates
|
|
79
|
+
|
|
80
|
+
## [1.0.3] - 2022-11-15
|
|
81
|
+
|
|
82
|
+
### 🔄 Improvements
|
|
83
|
+
|
|
84
|
+
- Data updates
|
|
85
|
+
|
|
86
|
+
## [1.0.2] - 2022-11-12
|
|
87
|
+
|
|
88
|
+
### 🔄 Improvements
|
|
89
|
+
|
|
90
|
+
- Data updates
|
|
91
|
+
|
|
92
|
+
## [1.0.1] - 2022-11-10
|
|
93
|
+
|
|
94
|
+
### 🐛 Bug Fixes
|
|
95
|
+
|
|
96
|
+
- Fixed initial release issues
|
|
97
|
+
- Improved error handling
|
|
98
|
+
|
|
99
|
+
## [1.0.0] - 2022-11-08
|
|
100
|
+
|
|
101
|
+
### 🆕 Initial Release
|
|
102
|
+
|
|
103
|
+
- Basic airport lookup by IATA and ICAO codes
|
|
104
|
+
- Search by country and continent
|
package/README.md
CHANGED
|
@@ -19,6 +19,10 @@ npm install airport-data-js
|
|
|
19
19
|
- 🕒 Timezone-based airport lookup
|
|
20
20
|
- 💡 Autocomplete suggestions for search interfaces
|
|
21
21
|
- 🎯 Advanced multi-criteria filtering
|
|
22
|
+
- 📊 Statistical analysis by country and continent
|
|
23
|
+
- 🔢 Bulk operations for multiple airports
|
|
24
|
+
- ✅ Code validation utilities
|
|
25
|
+
- 🎚️ Airport ranking by runway length and elevation
|
|
22
26
|
|
|
23
27
|
## Airport Data Structure
|
|
24
28
|
|
|
@@ -200,6 +204,135 @@ const links = await getAirportLinks('SIN');
|
|
|
200
204
|
// }
|
|
201
205
|
```
|
|
202
206
|
|
|
207
|
+
### Statistical & Analytical Functions
|
|
208
|
+
|
|
209
|
+
#### `getAirportStatsByCountry(countryCode)`
|
|
210
|
+
Gets comprehensive statistics about airports in a specific country.
|
|
211
|
+
|
|
212
|
+
```javascript
|
|
213
|
+
const stats = await getAirportStatsByCountry('US');
|
|
214
|
+
// Returns:
|
|
215
|
+
// {
|
|
216
|
+
// total: 5432,
|
|
217
|
+
// byType: {
|
|
218
|
+
// large_airport: 139,
|
|
219
|
+
// medium_airport: 467,
|
|
220
|
+
// small_airport: 4826
|
|
221
|
+
// },
|
|
222
|
+
// withScheduledService: 606,
|
|
223
|
+
// averageRunwayLength: 5234,
|
|
224
|
+
// averageElevation: 1245,
|
|
225
|
+
// timezones: ['America/New_York', 'America/Chicago', ...]
|
|
226
|
+
// }
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
#### `getAirportStatsByContinent(continentCode)`
|
|
230
|
+
Gets comprehensive statistics about airports on a specific continent.
|
|
231
|
+
|
|
232
|
+
```javascript
|
|
233
|
+
const stats = await getAirportStatsByContinent('AS');
|
|
234
|
+
// Returns statistics including count by type, by country,
|
|
235
|
+
// scheduled service count, average runway length, elevation, and timezones
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
#### `getLargestAirportsByContinent(continentCode, limit, sortBy)`
|
|
239
|
+
Gets the largest airports on a continent by runway length or elevation.
|
|
240
|
+
|
|
241
|
+
```javascript
|
|
242
|
+
// Get top 5 airports in Asia by runway length
|
|
243
|
+
const airports = await getLargestAirportsByContinent('AS', 5, 'runway');
|
|
244
|
+
|
|
245
|
+
// Get top 10 airports in South America by elevation
|
|
246
|
+
const highAltitude = await getLargestAirportsByContinent('SA', 10, 'elevation');
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
### Bulk Operations
|
|
250
|
+
|
|
251
|
+
#### `getMultipleAirports(codes)`
|
|
252
|
+
Fetches multiple airports by their IATA or ICAO codes in one call.
|
|
253
|
+
|
|
254
|
+
```javascript
|
|
255
|
+
const airports = await getMultipleAirports(['SIN', 'LHR', 'JFK', 'WSSS']);
|
|
256
|
+
// Returns array of airport objects (null for codes not found)
|
|
257
|
+
// Efficiently fetches multiple airports at once
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
#### `calculateDistanceMatrix(codes)`
|
|
261
|
+
Calculates distances between all pairs of airports in a list.
|
|
262
|
+
|
|
263
|
+
```javascript
|
|
264
|
+
const matrix = await calculateDistanceMatrix(['SIN', 'LHR', 'JFK']);
|
|
265
|
+
// Returns:
|
|
266
|
+
// {
|
|
267
|
+
// airports: [
|
|
268
|
+
// { code: 'SIN', name: 'Singapore Changi Airport', iata: 'SIN', icao: 'WSSS' },
|
|
269
|
+
// { code: 'LHR', name: 'London Heathrow Airport', iata: 'LHR', icao: 'EGLL' },
|
|
270
|
+
// { code: 'JFK', name: 'John F Kennedy International Airport', iata: 'JFK', icao: 'KJFK' }
|
|
271
|
+
// ],
|
|
272
|
+
// distances: {
|
|
273
|
+
// SIN: { SIN: 0, LHR: 10872, JFK: 15344 },
|
|
274
|
+
// LHR: { SIN: 10872, LHR: 0, JFK: 5540 },
|
|
275
|
+
// JFK: { SIN: 15344, LHR: 5540, JFK: 0 }
|
|
276
|
+
// }
|
|
277
|
+
// }
|
|
278
|
+
```
|
|
279
|
+
|
|
280
|
+
#### `findNearestAirport(lat, lon, filters)`
|
|
281
|
+
Finds the single nearest airport to given coordinates, optionally with filters.
|
|
282
|
+
|
|
283
|
+
```javascript
|
|
284
|
+
// Find nearest airport to coordinates
|
|
285
|
+
const nearest = await findNearestAirport(1.35019, 103.994003);
|
|
286
|
+
// Returns airport object with additional 'distance' field in km
|
|
287
|
+
|
|
288
|
+
// Find nearest large airport with scheduled service
|
|
289
|
+
const nearestHub = await findNearestAirport(1.35019, 103.994003, {
|
|
290
|
+
type: 'large_airport',
|
|
291
|
+
has_scheduled_service: true
|
|
292
|
+
});
|
|
293
|
+
```
|
|
294
|
+
|
|
295
|
+
### Validation & Utilities
|
|
296
|
+
|
|
297
|
+
#### `validateIataCode(code)`
|
|
298
|
+
Validates if an IATA code exists in the database.
|
|
299
|
+
|
|
300
|
+
```javascript
|
|
301
|
+
const isValid = await validateIataCode('SIN'); // true
|
|
302
|
+
const isInvalid = await validateIataCode('XYZ'); // false
|
|
303
|
+
const isBadFormat = await validateIataCode('ABCD'); // false
|
|
304
|
+
```
|
|
305
|
+
|
|
306
|
+
#### `validateIcaoCode(code)`
|
|
307
|
+
Validates if an ICAO code exists in the database.
|
|
308
|
+
|
|
309
|
+
```javascript
|
|
310
|
+
const isValid = await validateIcaoCode('WSSS'); // true
|
|
311
|
+
const isInvalid = await validateIcaoCode('XXXX'); // false
|
|
312
|
+
```
|
|
313
|
+
|
|
314
|
+
#### `getAirportCount(filters)`
|
|
315
|
+
Gets the count of airports matching the given filters without fetching all data.
|
|
316
|
+
|
|
317
|
+
```javascript
|
|
318
|
+
// Get total airport count
|
|
319
|
+
const total = await getAirportCount();
|
|
320
|
+
|
|
321
|
+
// Get count of large airports in the US
|
|
322
|
+
const count = await getAirportCount({
|
|
323
|
+
country_code: 'US',
|
|
324
|
+
type: 'large_airport'
|
|
325
|
+
});
|
|
326
|
+
```
|
|
327
|
+
|
|
328
|
+
#### `isAirportOperational(code)`
|
|
329
|
+
Checks if an airport has scheduled commercial service.
|
|
330
|
+
|
|
331
|
+
```javascript
|
|
332
|
+
const operational = await isAirportOperational('SIN'); // true
|
|
333
|
+
const notOperational = await isAirportOperational('SOME_SMALL_AIRPORT'); // false
|
|
334
|
+
```
|
|
335
|
+
|
|
203
336
|
## Error Handling
|
|
204
337
|
|
|
205
338
|
All functions return promises and may throw errors for invalid input or when no data is found.
|
|
@@ -247,32 +380,65 @@ const asianHubs = await findAirports({
|
|
|
247
380
|
});
|
|
248
381
|
```
|
|
249
382
|
|
|
383
|
+
### Get airport statistics
|
|
384
|
+
```javascript
|
|
385
|
+
// Get comprehensive statistics for US airports
|
|
386
|
+
const usStats = await getAirportStatsByCountry('US');
|
|
387
|
+
console.log(`Total airports: ${usStats.total}`);
|
|
388
|
+
console.log(`Large airports: ${usStats.byType.large_airport}`);
|
|
389
|
+
console.log(`Average runway length: ${usStats.averageRunwayLength} ft`);
|
|
390
|
+
|
|
391
|
+
// Get statistics for Asian airports
|
|
392
|
+
const asiaStats = await getAirportStatsByContinent('AS');
|
|
393
|
+
console.log(`Countries with airports: ${Object.keys(asiaStats.byCountry).length}`);
|
|
394
|
+
```
|
|
395
|
+
|
|
396
|
+
### Bulk operations
|
|
397
|
+
```javascript
|
|
398
|
+
// Fetch multiple airports at once
|
|
399
|
+
const airports = await getMultipleAirports(['SIN', 'LHR', 'JFK', 'NRT']);
|
|
400
|
+
airports.forEach(airport => {
|
|
401
|
+
if (airport) {
|
|
402
|
+
console.log(`${airport.iata}: ${airport.airport}`);
|
|
403
|
+
}
|
|
404
|
+
});
|
|
405
|
+
|
|
406
|
+
// Calculate distance matrix for route planning
|
|
407
|
+
const matrix = await calculateDistanceMatrix(['SIN', 'LHR', 'JFK']);
|
|
408
|
+
console.log(`Distance from SIN to LHR: ${matrix.distances.SIN.LHR} km`);
|
|
409
|
+
console.log(`Distance from LHR to JFK: ${matrix.distances.LHR.JFK} km`);
|
|
410
|
+
```
|
|
411
|
+
|
|
412
|
+
### Validation utilities
|
|
413
|
+
```javascript
|
|
414
|
+
// Validate airport codes before processing
|
|
415
|
+
const codes = ['SIN', 'XYZ', 'LHR', 'ABCD'];
|
|
416
|
+
for (const code of codes) {
|
|
417
|
+
const isValid = await validateIataCode(code);
|
|
418
|
+
console.log(`${code}: ${isValid ? 'Valid' : 'Invalid'}`);
|
|
419
|
+
}
|
|
420
|
+
|
|
421
|
+
// Check if airport is operational
|
|
422
|
+
const operational = await isAirportOperational('SIN');
|
|
423
|
+
console.log(`Singapore Changi is operational: ${operational}`);
|
|
424
|
+
```
|
|
425
|
+
|
|
426
|
+
### Find nearest airport
|
|
427
|
+
```javascript
|
|
428
|
+
// Find nearest airport to current location
|
|
429
|
+
const nearest = await findNearestAirport(1.35019, 103.994003);
|
|
430
|
+
console.log(`Nearest airport: ${nearest.airport} (${nearest.distance} km away)`);
|
|
431
|
+
|
|
432
|
+
// Find nearest large airport with scheduled service
|
|
433
|
+
const nearestHub = await findNearestAirport(1.35019, 103.994003, {
|
|
434
|
+
type: 'large_airport',
|
|
435
|
+
has_scheduled_service: true
|
|
436
|
+
});
|
|
437
|
+
```
|
|
438
|
+
|
|
250
439
|
## Changelog
|
|
251
440
|
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
#### 🆕 New Features
|
|
255
|
-
- **`getAirportsByTimezone(timezone)`** - Find airports by timezone
|
|
256
|
-
- **`getAirportLinks(code)`** - Get external links for airports
|
|
257
|
-
- **`findAirports(filters)`** - Advanced multi-criteria filtering
|
|
258
|
-
- **`getAutocompleteSuggestions(query)`** - Autocomplete functionality
|
|
259
|
-
- **Enhanced `getAirportsByType(type)`** - Now supports convenience search for "airport" type
|
|
260
|
-
- **External links support** - Wikipedia, websites, and flight tracking URLs
|
|
261
|
-
- **Timezone information** - Complete timezone data for all airports
|
|
262
|
-
- **Runway length data** - Airport runway information included
|
|
263
|
-
- **Scheduled service indicator** - Whether airports have commercial scheduled service
|
|
264
|
-
|
|
265
|
-
#### 🔄 Improvements
|
|
266
|
-
- Better error handling and validation
|
|
267
|
-
- More comprehensive airport data structure
|
|
268
|
-
- Improved type filtering with partial matching
|
|
269
|
-
- Enhanced geographic calculations
|
|
270
|
-
- Case-insensitive search improvements
|
|
271
|
-
|
|
272
|
-
#### ❌ Removed from v1.x
|
|
273
|
-
- Legacy data format support
|
|
274
|
-
- Simplified airport objects (expanded to include more fields)
|
|
275
|
-
- Basic filtering (replaced with advanced `findAirports` function)
|
|
441
|
+
See [CHANGELOG.md](CHANGELOG.md) for the full version history and release notes.
|
|
276
442
|
|
|
277
443
|
## Data Source
|
|
278
444
|
|