diff --git a/README.md b/README.md index 3829bb5..7555fce 100644 --- a/README.md +++ b/README.md @@ -117,11 +117,9 @@ Which tags you use depend on use-case. If your concerns are namely geospacial, u - **`isoAsNamespace==false [default]`** - Alpha-2 code: `[ 'g', 'HU', 'countryCode' ]` - Alpha-3 code: `[ 'g', 'HUN', 'countryCode']` - - Numeric code: `[ 'g', '348', 'countryCode' ]` - **`isoAsNamespace==true`** - Alpha-2 code: `[ 'g', 'HU', 'ISO-3166-1' ]` - Alpha-3 code: `[ 'g', 'HUN', 'ISO-3166-1']` - - Numeric code: `[ 'g', '348', 'ISO-3166-1' ]` 4. **ISO-3166-2 Codes**: - These tags represent region information derived from the `iso-3166` library and are based on the `countryCode` and `regionCode` input values. They are not passthrough values. diff --git a/package.json b/package.json index 19ed8db..38deaae 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "nostr-geotags", - "version": "0.4.1", + "version": "0.5.0", "description": "Give an object of geodata, returns standardized nostr geotags ", "type": "module", "main": "dist/index.js", diff --git a/src/index.test.ts b/src/index.test.ts index 3c3cf0f..b2443f8 100644 --- a/src/index.test.ts +++ b/src/index.test.ts @@ -70,7 +70,6 @@ describe('generateTags()', () => { [ 'G', 'countryCode' ], [ 'g', 'HU', 'countryCode' ], [ 'g', 'HUN', 'countryCode' ], - [ 'g', '348', 'countryCode' ], [ 'G', 'countryName' ], [ 'g', 'Hungary', 'countryName' ], [ 'G', 'regionCode' ], @@ -168,7 +167,7 @@ describe('generateTags()', () => { const result = ngeotags(input, options); console.log('all high specificity', result.length, result) - expect(result).toHaveLength(34); + expect(result).toHaveLength(33); }) it('should generate legacy tags when opts.legacy is true', () => { @@ -245,7 +244,6 @@ describe('generateTags()', () => { [ 'g', '19', 'lon' ], [ 'g', 'HU', 'countryCode' ], [ 'g', 'HUN', 'countryCode' ], - [ 'g', '348', 'countryCode' ], [ 'g', 'Hungary', 'countryName' ], [ 'g', 'HU-BU', 'regionCode' ] ]) @@ -270,7 +268,6 @@ describe('generateTags()', () => { [ 'G', 'countryCode' ], [ 'g', 'HU', 'countryCode'], [ 'g', 'HUN', 'countryCode' ], - [ 'g', '348', 'countryCode' ], [ 'G', 'countryName' ], [ 'g', 'Hungary', 'countryName' ], [ 'G', 'regionCode' ], @@ -454,7 +451,6 @@ describe('generateTags()', () => { [ 'G', 'countryCode' ], [ 'g', 'HU', 'countryCode'], [ 'g', 'HUN', 'countryCode' ], - [ 'g', '348', 'countryCode' ], [ 'G', 'countryName' ], [ 'g', 'Hungary', 'countryName' ] ])); @@ -507,7 +503,6 @@ describe('generateTags()', () => { [ 'G', 'countryCode' ], [ 'g', 'AI', 'countryCode'], [ 'g', 'AIA', 'countryCode' ], - [ 'g', '660', 'countryCode' ], [ 'G', 'countryName' ], [ 'g', 'Anguilla', 'countryName' ], [ 'G', 'countryCode' ], @@ -535,7 +530,6 @@ describe('generateTags()', () => { ['G', 'countryCode'], [ 'g', 'DE', 'countryCode' ], [ 'g', 'DEU', 'countryCode' ], - [ 'g', '276', 'countryCode' ], ])) }); @@ -585,7 +579,6 @@ describe('generateTags()', () => { ['G', 'countryCode'], [ 'g', 'HU', 'countryCode' ], [ 'g', 'HUN', 'countryCode' ], - [ 'g', '348', 'countryCode' ], [ 'G', 'countryName' ], [ 'g', 'Hungary', 'countryName' ] ])) @@ -674,7 +667,6 @@ describe('namespace inflection', () => { [ 'G', 'countryCode' ], [ 'g', 'HU', 'countryCode' ], [ 'g', 'HUN', 'countryCode' ], - [ 'g', '348', 'countryCode'], [ 'G', 'countryName' ], [ 'g', 'Hungary', 'countryName' ] ])); @@ -753,7 +745,6 @@ describe('sortTagsByKey()', () => { [ 'g', 'HU', 'countryCode'], [ 'G', 'countryCode' ], [ 'g', 'HUN', 'countryCode' ], - [ 'g', '348', 'countryCode' ] ]; console.log('before sort', tags) @@ -764,7 +755,6 @@ describe('sortTagsByKey()', () => { [ 'G', 'countryCode' ], [ 'g', 'HU', 'countryCode' ], [ 'g', 'HUN', 'countryCode'], - [ 'g', '348', 'countryCode' ] ]); }); }) @@ -774,7 +764,6 @@ describe('filterOutType()', () => { const tags: GeoTags[] = [ ['g', 'HU', 'countryCode'], ['g', 'HUN', 'countryCode'], - ['g', '348', 'countryCode'], ['g', 'HU-BU', 'regionCode'] ]; diff --git a/src/index.ts b/src/index.ts index 26bbf92..ffe09dd 100644 --- a/src/index.ts +++ b/src/index.ts @@ -108,7 +108,7 @@ const DD_MAX_RES_DEFAULT = 9 /** * Retrieves updated ISO-3166-3 values based on a given code. * - * @param {ISO31663FieldType} type - The type of the ISO-3166-3 field (alpha2, alpha3, numeric, name). + * @param {ISO31663FieldType} type - The type of the ISO-3166-3 field (alpha2, alpha3, name). * @param {string} code - The ISO-3166-3 code to find updated values for. * @returns {string[]} An array of updated ISO-3166-3 values. * @@ -227,7 +227,6 @@ const generateTags = (input: InputData, opts: Options): GeoTags[] => { if (countryData) { iso31661Tags.push(['g', countryData.alpha2, namespace]); iso31661Tags.push(['g', countryData.alpha3, namespace]); - iso31661Tags.push(['g', countryData.numeric, namespace]); if(countryData.name) { iso31661Tags.push(['G', 'countryName']); iso31661Tags.push(['g', countryData.name, 'countryName']); @@ -261,7 +260,7 @@ const generateTags = (input: InputData, opts: Options): GeoTags[] => { const iso31663Tags: LabelTag[] = []; // Iterate over all types and check for updated values - (['alpha2', 'alpha3', 'numeric', 'name'] as const).forEach(type => { + (['alpha2', 'alpha3', 'name'] as const).forEach(type => { const originalValue = countryData[type as keyof ISO31661Entry]; const updatedValues = getUpdatedIso31663Values(type, originalValue); @@ -281,12 +280,12 @@ const generateTags = (input: InputData, opts: Options): GeoTags[] => { } } - if ((opts.city || opts.cityName) && input.cityName && !opts.legacy) { + if ((opts.city || opts.cityName) && input.cityName) { tags.push(['G', 'cityName']); tags.push(['g', input.cityName, 'cityName']); } - if ((opts.planet || opts.planetName) && input.planetName && !opts.legacy) { + if ((opts.planet || opts.planetName) && input.planetName) { tags.push(['G', 'planetName']); tags.push(['g', input.planetName, 'planetName']); }