airport-data-js 2.0.0 → 3.0.1

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 ADDED
@@ -0,0 +1,109 @@
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
+
9
+ ## [3.0.1] - 2026-01-24
10
+
11
+ ### 🔄 Improvements
12
+
13
+ - Airport data update Jan 2026
14
+
15
+ ### [3.0.0] - 2025-12-05
16
+
17
+ #### 🆕 New Features
18
+
19
+ - **`getAirportStatsByCountry(countryCode)`** - Get comprehensive statistics for airports in a country
20
+ - **`getAirportStatsByContinent(continentCode)`** - Get comprehensive statistics for airports on a continent
21
+ - **`getLargestAirportsByContinent(continentCode, limit, sortBy)`** - Get largest airports by runway or elevation
22
+ - **`getMultipleAirports(codes)`** - Bulk fetch multiple airports in one call
23
+ - **`calculateDistanceMatrix(codes)`** - Calculate distances between all pairs of airports
24
+ - **`findNearestAirport(lat, lon, filters)`** - Find single nearest airport with optional filters
25
+ - **`validateIataCode(code)`** - Validate IATA code existence
26
+ - **`validateIcaoCode(code)`** - Validate ICAO code existence
27
+ - **`getAirportCount(filters)`** - Get count of airports matching filters
28
+ - **`isAirportOperational(code)`** - Check if airport has scheduled service
29
+
30
+ #### 🔄 Improvements
31
+
32
+ - Enhanced bulk operations for better performance
33
+ - Added comprehensive statistical analysis capabilities
34
+ - Improved validation utilities for code checking
35
+ - Better support for route planning and analysis
36
+ - Professional build pipeline with duplicate checking
37
+ - Automated release notes from changelog
38
+
39
+ ## [2.0.0] - 2024-07-24
40
+
41
+ ### 🆕 New Features
42
+
43
+ - **`getAirportsByTimezone(timezone)`** - Find airports by timezone
44
+ - **`getAirportLinks(code)`** - Get external links for airports
45
+ - **`findAirports(filters)`** - Advanced multi-criteria filtering
46
+ - **`getAutocompleteSuggestions(query)`** - Autocomplete functionality
47
+ - **Enhanced `getAirportsByType(type)`** - Now supports convenience search for "airport" type
48
+ - **External links support** - Wikipedia, websites, and flight tracking URLs
49
+ - **Timezone information** - Complete timezone data for all airports
50
+ - **Runway length data** - Airport runway information included
51
+ - **Scheduled service indicator** - Whether airports have commercial scheduled service
52
+
53
+ ### 🔄 Improvements
54
+
55
+ - Better error handling and validation
56
+ - More comprehensive airport data structure
57
+ - Improved type filtering with partial matching
58
+ - Enhanced geographic calculations
59
+ - Case-insensitive search improvements
60
+
61
+ ### ❌ Breaking Changes
62
+
63
+ - Legacy data format no longer supported
64
+ - Simplified airport objects expanded to include more fields
65
+ - Basic filtering replaced with advanced `findAirports` function
66
+
67
+ ## [1.0.6] - 2022-11-24
68
+
69
+ ### 🔄 Improvements
70
+
71
+ - Data updates
72
+
73
+ ## [1.0.5] - 2022-11-20
74
+
75
+ ### 🔄 Improvements
76
+
77
+ - Data updates
78
+
79
+ ## [1.0.4] - 2022-11-18
80
+
81
+ ### 🔄 Improvements
82
+
83
+ - Data updates
84
+
85
+ ## [1.0.3] - 2022-11-15
86
+
87
+ ### 🔄 Improvements
88
+
89
+ - Data updates
90
+
91
+ ## [1.0.2] - 2022-11-12
92
+
93
+ ### 🔄 Improvements
94
+
95
+ - Data updates
96
+
97
+ ## [1.0.1] - 2022-11-10
98
+
99
+ ### 🐛 Bug Fixes
100
+
101
+ - Fixed initial release issues
102
+ - Improved error handling
103
+
104
+ ## [1.0.0] - 2022-11-08
105
+
106
+ ### 🆕 Initial Release
107
+
108
+ - Basic airport lookup by IATA and ICAO codes
109
+ - 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
- ### Version 2.0.0 (Latest)
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