@ham2k/lib-operation-data 0.10.0 → 0.10.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/README.md +0 -86
- package/package.json +1 -1
- package/src/lib/bands.ts +42 -1
- package/src/lib/modes.ts +5 -11
package/README.md
CHANGED
|
@@ -1,89 +1,3 @@
|
|
|
1
1
|
# lib-operation-data
|
|
2
2
|
|
|
3
3
|
Basic data related to Amateur Radio operation, such as bands, modes, etc
|
|
4
|
-
|
|
5
|
-
## Building
|
|
6
|
-
|
|
7
|
-
This module is written in TypeScript and must be compiled before use.
|
|
8
|
-
|
|
9
|
-
### Development
|
|
10
|
-
|
|
11
|
-
To build the module during development:
|
|
12
|
-
|
|
13
|
-
```bash
|
|
14
|
-
npm run build
|
|
15
|
-
```
|
|
16
|
-
|
|
17
|
-
This will compile TypeScript source files from `src/` to JavaScript in `dist/`, generating:
|
|
18
|
-
- JavaScript files (`.js`)
|
|
19
|
-
- TypeScript declaration files (`.d.ts`)
|
|
20
|
-
- Source maps (`.js.map`, `.d.ts.map`)
|
|
21
|
-
|
|
22
|
-
### Testing
|
|
23
|
-
|
|
24
|
-
Run the test suite:
|
|
25
|
-
|
|
26
|
-
```bash
|
|
27
|
-
npm test
|
|
28
|
-
```
|
|
29
|
-
|
|
30
|
-
## Distribution
|
|
31
|
-
|
|
32
|
-
### Publishing to npm
|
|
33
|
-
|
|
34
|
-
Before publishing, ensure the module is built:
|
|
35
|
-
|
|
36
|
-
```bash
|
|
37
|
-
npm run build
|
|
38
|
-
```
|
|
39
|
-
|
|
40
|
-
The `prepublishOnly` script will automatically run the build before publishing, so you can also just:
|
|
41
|
-
|
|
42
|
-
```bash
|
|
43
|
-
npm publish
|
|
44
|
-
```
|
|
45
|
-
|
|
46
|
-
### Package Structure
|
|
47
|
-
|
|
48
|
-
- **Source files**: Located in `src/`
|
|
49
|
-
- **Compiled output**: Generated in `dist/` (excluded from git)
|
|
50
|
-
- **Type definitions**: Automatically generated in `dist/` alongside compiled JavaScript
|
|
51
|
-
|
|
52
|
-
### Module Exports
|
|
53
|
-
|
|
54
|
-
The package exports are configured in `package.json`:
|
|
55
|
-
- **Main entry**: `dist/index.js`
|
|
56
|
-
- **Type definitions**: `dist/index.d.ts`
|
|
57
|
-
- **ESM support**: Configured for ES2020 modules
|
|
58
|
-
|
|
59
|
-
## Usage
|
|
60
|
-
|
|
61
|
-
### Installation
|
|
62
|
-
|
|
63
|
-
```bash
|
|
64
|
-
npm install @ham2k/lib-operation-data
|
|
65
|
-
```
|
|
66
|
-
|
|
67
|
-
### Import
|
|
68
|
-
|
|
69
|
-
```javascript
|
|
70
|
-
import { BANDS, bandForFrequency, modeForFrequency } from '@ham2k/lib-operation-data'
|
|
71
|
-
```
|
|
72
|
-
|
|
73
|
-
### TypeScript
|
|
74
|
-
|
|
75
|
-
Type definitions are included, so TypeScript projects will automatically get type checking and autocomplete:
|
|
76
|
-
|
|
77
|
-
```typescript
|
|
78
|
-
import { BANDS, Band, bandForFrequency } from '@ham2k/lib-operation-data'
|
|
79
|
-
|
|
80
|
-
const band: Band = bandForFrequency(14255) // '20m'
|
|
81
|
-
```
|
|
82
|
-
|
|
83
|
-
## Development Setup
|
|
84
|
-
|
|
85
|
-
1. Clone the repository
|
|
86
|
-
2. Install dependencies: `npm install`
|
|
87
|
-
3. Make changes in `src/`
|
|
88
|
-
4. Build: `npm run build`
|
|
89
|
-
5. Test: `npm test`
|
package/package.json
CHANGED
package/src/lib/bands.ts
CHANGED
|
@@ -1,3 +1,40 @@
|
|
|
1
|
+
export const EXTENDED_BANDS = [ // Includes 11m
|
|
2
|
+
'2190m',
|
|
3
|
+
'630m',
|
|
4
|
+
'560m',
|
|
5
|
+
'160m',
|
|
6
|
+
'80m',
|
|
7
|
+
'60m',
|
|
8
|
+
'40m',
|
|
9
|
+
'30m',
|
|
10
|
+
'20m',
|
|
11
|
+
'17m',
|
|
12
|
+
'15m',
|
|
13
|
+
'12m',
|
|
14
|
+
'11m',
|
|
15
|
+
'10m',
|
|
16
|
+
'6m',
|
|
17
|
+
'5m',
|
|
18
|
+
'4m',
|
|
19
|
+
'2m',
|
|
20
|
+
'1.25m',
|
|
21
|
+
'70cm',
|
|
22
|
+
'33cm',
|
|
23
|
+
'23cm',
|
|
24
|
+
'13cm',
|
|
25
|
+
'9cm',
|
|
26
|
+
'6cm',
|
|
27
|
+
'3cm',
|
|
28
|
+
'1.25cm',
|
|
29
|
+
'6mm',
|
|
30
|
+
'4mm',
|
|
31
|
+
'2.5mm',
|
|
32
|
+
'2mm',
|
|
33
|
+
'1mm',
|
|
34
|
+
'submm',
|
|
35
|
+
'other'
|
|
36
|
+
] as const
|
|
37
|
+
|
|
1
38
|
export const BANDS = [
|
|
2
39
|
'2190m',
|
|
3
40
|
'630m',
|
|
@@ -34,7 +71,7 @@ export const BANDS = [
|
|
|
34
71
|
'other'
|
|
35
72
|
] as const
|
|
36
73
|
|
|
37
|
-
export type Band = typeof
|
|
74
|
+
export type Band = typeof EXTENDED_BANDS[number]
|
|
38
75
|
|
|
39
76
|
export const HF_BANDS = ['160m', '80m', '60m', '40m', '30m', '20m', '17m', '15m', '12m', '10m'] as const
|
|
40
77
|
export const VHF_BANDS = ['6m', '5m', '4m', '2m', '1.25m'] as const
|
|
@@ -62,6 +99,7 @@ function bandForExactFrequencyInMHz(freq: number): Band | undefined {
|
|
|
62
99
|
else if (freq >= 18000 && freq <= 18200) return '17m'
|
|
63
100
|
else if (freq >= 20900 && freq <= 21600) return '15m'
|
|
64
101
|
else if (freq >= 24500 && freq <= 25200) return '12m'
|
|
102
|
+
else if (freq >= 26000 && freq <= 27500) return '11m'
|
|
65
103
|
else if (freq >= 27900 && freq <= 30000) return '10m'
|
|
66
104
|
else if (freq >= 50000 && freq <= 54000) return '6m'
|
|
67
105
|
else if (freq >= 54001 && freq <= 69999) return '5m'
|
|
@@ -138,6 +176,9 @@ export function frequencyForBand(band: Band, mode?: string): number | undefined
|
|
|
138
176
|
else if (mode === 'FT4') return 24919
|
|
139
177
|
else return 24890
|
|
140
178
|
}
|
|
179
|
+
else if (band === '11m') {
|
|
180
|
+
return 26965
|
|
181
|
+
}
|
|
141
182
|
else if (band === '10m') {
|
|
142
183
|
if (mode === 'SSB' || mode === 'USB') return 28300
|
|
143
184
|
else if (mode === 'FM' || mode === 'AM') return 28500
|
package/src/lib/modes.ts
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import BandPlans from '../data/bandPlans.json'
|
|
2
2
|
import type { BandPlansData, SegmentWithMetadata, ModeForFrequencyOptions } from '../types'
|
|
3
3
|
|
|
4
|
-
export const SUPER_MODES = [
|
|
4
|
+
export const SUPER_MODES: readonly string[] = [
|
|
5
5
|
'CW',
|
|
6
6
|
'PHONE',
|
|
7
7
|
'DATA'
|
|
8
8
|
] as const
|
|
9
9
|
|
|
10
|
-
export type SuperMode =
|
|
10
|
+
export type SuperMode = 'CW' | 'PHONE' | 'DATA'
|
|
11
11
|
|
|
12
|
-
export const MAIN_MODES = [
|
|
12
|
+
export const MAIN_MODES: readonly string[] = [
|
|
13
13
|
'CW',
|
|
14
14
|
'SSB',
|
|
15
15
|
'AM',
|
|
@@ -19,9 +19,7 @@ export const MAIN_MODES = [
|
|
|
19
19
|
'RTTY'
|
|
20
20
|
] as const
|
|
21
21
|
|
|
22
|
-
export
|
|
23
|
-
|
|
24
|
-
export const POPULAR_MODES = [
|
|
22
|
+
export const POPULAR_MODES: readonly string[] = [
|
|
25
23
|
'CW',
|
|
26
24
|
'SSB',
|
|
27
25
|
'USB',
|
|
@@ -49,9 +47,7 @@ export const POPULAR_MODES = [
|
|
|
49
47
|
'WSPR',
|
|
50
48
|
] as const
|
|
51
49
|
|
|
52
|
-
export
|
|
53
|
-
|
|
54
|
-
export const ADIF_MODES = [
|
|
50
|
+
export const ADIF_MODES: readonly string[] = [
|
|
55
51
|
'AM',
|
|
56
52
|
'ARDOP',
|
|
57
53
|
'ATV',
|
|
@@ -100,8 +96,6 @@ export const ADIF_MODES = [
|
|
|
100
96
|
'WSPR'
|
|
101
97
|
] as const
|
|
102
98
|
|
|
103
|
-
export type AdifMode = typeof ADIF_MODES[number]
|
|
104
|
-
|
|
105
99
|
export const ADIF_SUBMODES: Record<string, readonly string[]> = {
|
|
106
100
|
'CHIP': ['CHIP64', 'CHIP128'],
|
|
107
101
|
'DIGITALVOICE': ['C4FM', 'DMR', 'DSTAR', 'FREEDV', 'M17'],
|