Skip to content

Commit

Permalink
remove redundant condition
Browse files Browse the repository at this point in the history
  • Loading branch information
dskvr committed Jan 18, 2024
1 parent 80195e3 commit 85da233
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 43 deletions.
22 changes: 0 additions & 22 deletions src/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -506,28 +506,6 @@ describe('generateTags()', () => {
]));
});

// it('should handle continent name correctly', () => {
// const input: InputData = {
// continentName: 'Europe'
// };

// const result = ngeotags(input, { continentName: true });
// expect(result).toContainEqual(['g', 'Europe', 'continentName']);
// });

// it('should handle continent code correctly', () => {
// const input: InputData = {
// continentCode: 'EU'
// };

// const result = ngeotags(input, { continentCode: true });
// console.log('continentCode', result)
// expect(result).toEqual(expect.arrayContaining([
// [ 'G', 'UN M49' ],
// [ 'g', 'EU', 'UN M49' ]
// ]));
// });

it('should include Earth as planet when enabled', () => {
const input: InputData = { planetName: 'Earth' };

Expand Down
22 changes: 1 addition & 21 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ export interface InputData {
countryName?: string;
regionName?: string;
countryCode?: string;
// continentName?: string;
// continentCode?: string;
planetName?: string;
[key: string]: any;
}
Expand All @@ -35,9 +33,6 @@ export interface Options {
region?: boolean,
regionName?: boolean | null,
regionCode?: boolean | null,
// continent?: boolean,
// continentName?: boolean | null,
// continentCode?: boolean | null,
planet?: boolean,
planetName?: boolean | null,
}
Expand Down Expand Up @@ -260,17 +255,6 @@ const generateTags = (input: InputData, opts: Options): GeoTags[] => {
tags.push(['g', input.cityName, 'cityName']);
}

// if ((opts.continent || opts.continentName) && input.continentName) {
// tags.push(['G', 'continentName']);
// tags.push(['g', input.continentName, 'continentName']);
// }

// if ((opts.continent || opts.continentCode) && input.continentCode) {
// const namespace = opts.unM49AsNamespace ? 'UN M49' : 'continentCode';
// tags.push(['G', namespace]);
// tags.push(['g', input.continentCode, namespace]);
// }

if ((opts.planet || opts.planetName) && input.planetName) {
tags.push(['G', 'planetName']);
tags.push(['g', input.planetName, 'planetName']);
Expand All @@ -293,7 +277,7 @@ const generateTags = (input: InputData, opts: Options): GeoTags[] => {
};

export const sanitize = (tags: GeoTags[]): GeoTags[] => {
tags = tags.filter(tag => tag[0] === 'g' || tag[0] === 'G' || tag[0] === 'g')
tags = tags.filter(tag => tag[0] === 'g' || tag[0] === 'G' )
tags = filterNonStringTags(tags)
return tags
}
Expand Down Expand Up @@ -400,10 +384,6 @@ export default (input: InputData | null, opts?: Options): GeoTags[] => {
regionName: null,
regionCode: null,

// continent: true,
// continentName: null,
// continentCode: null,

planet: false,
planetName: null,
...opts
Expand Down

0 comments on commit 85da233

Please sign in to comment.