New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@ixnode/geo-sphere

Package Overview
Dependencies
Maintainers
1
Versions
44
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ixnode/geo-sphere - npm Package Compare versions

Comparing version

to
0.1.32

dist/types/src/components/WorldMap/db/cities.d.ts

7

dist/types/src/components/WorldMap/classes/DataConverter.d.ts

@@ -13,8 +13,2 @@ import { InterfaceGeoJson, TypeCountryKey, TypeDataSource, TypeFeature } from "../types/types";

private coordinateConverter;
private readonly propertyCountrySelectedFill;
private readonly propertyCountrySelectedStroke;
private readonly propertyCountrySelectedStrokeWidth;
private readonly propertiesCityFill;
private readonly propertiesCityStroke;
private readonly propertiesCityStrokeWidth;
private readonly countryMap;

@@ -65,3 +59,2 @@ /**

* @param geoJson
* @see cities
*/

@@ -68,0 +61,0 @@ private addCities;

31

dist/types/src/components/WorldMap/config/cities.d.ts

@@ -0,1 +1,2 @@

import { TypeCityData } from "../db/cities";
/**

@@ -14,34 +15,4 @@ * General names.

/**
* General types.
*/
export type TypeCityData = {
[key: string]: TypeCity;
};
export type TypeCityType = "capital" | "state-capital" | "city";
export type TypeCitySize = "standard" | "smaller" | "bigger";
export type TypeCity = {
coordinate: [number, number];
priority: number;
size: TypeCitySize;
country: string;
type: TypeCityType;
name: string;
nameCz: string | null;
nameDe: string | null;
nameEn: string | null;
nameEs: string | null;
nameFr: string | null;
nameHr: string | null;
nameIt: string | null;
namePl: string | null;
nameSv: string | null;
population: number | null;
};
/**
* City data.
*/
export declare const cities: TypeCity[];
/**
* Convert cities to easy accessible array.
*/
export declare const getCityMap: () => TypeCityData;

@@ -0,26 +1,5 @@

import { TypeCountryData } from "../db/countries";
/**
* General types.
*/
export type TypeCountryData = {
[key: string]: TypeCountry;
};
export type TypeCountry = {
code: string | null;
nameCz: string;
nameDe: string;
nameEn: string;
nameEs: string;
nameFr: string;
nameHr: string;
nameIt: string;
namePl: string;
nameSv: string;
};
/**
* City data.
*/
export declare const countries: TypeCountry[];
/**
* Convert countries to easy accessible array.
*/
export declare const getCountryMap: () => TypeCountryData;
import React from "react";
import { TFunction } from "i18next";
import { Point } from "../config/interfaces";
import { TypeCity } from "../config/cities";
import { TypeCountry } from "../config/countries";
import { TypeSvgElement } from "../types/types";
import { TypeCountry } from "../db/countries";
import { TypeCity } from "../db/cities";
/**

@@ -8,0 +8,0 @@ * Default texts

@@ -1,4 +0,4 @@

import { TypeCountry } from "../config/countries";
import { TypeCity } from "../config/cities";
import { TypeCountryKey } from "../types/types";
import { TypeCountryTranslation } from "../db/countries";
import { TypeCity, TypeCityTranslation } from "../db/cities";
/**

@@ -9,3 +9,3 @@ * Returns the language name of given language.

*/
export declare const getLanguageNameCountry: (language: string) => keyof TypeCountry;
export declare const getLanguageNameCountry: (language: string) => keyof TypeCountryTranslation;
/**

@@ -16,3 +16,3 @@ * Returns the language name of given language.

*/
export declare const getLanguageNamePlace: (language: string) => keyof TypeCity;
export declare const getLanguageNamePlace: (language: string) => keyof TypeCityTranslation;
/**

@@ -30,2 +30,2 @@ * Returns the translated name.

*/
export declare const getTranslation: (country: TypeCountryKey | null) => TypeCountry | null;
export declare const getTranslation: (country: TypeCountryKey | null) => TypeCountryTranslation | null;
import { FeatureCollection } from 'geojson';
import { CountryData, PlaceData } from "../config/interfaces";
import { TypeCitySize, TypeCityType } from "../config/cities";
import { TypeCitySize, TypeCityType } from "../db/cities";
export type TypeProperties = {

@@ -5,0 +5,0 @@ name?: string;

{
"name": "@ixnode/geo-sphere",
"version": "0.1.31",
"version": "0.1.32",
"description": "A Node.js package for rendering interactive world maps with Mercator projection, customizable languages, and advanced interactivity features such as zoom, pan, and click events.",

@@ -5,0 +5,0 @@ "main": "dist/index.cjs",

@@ -0,11 +1,23 @@

/* Import configuration. */
import {getCountryMap} from "../config/countries";
import {classNameSvgCircle} from "../config/elementNames";
/* Import types. */
import {InterfaceGeoJson, TypeCountryKey, TypeDataSource, TypeFeature} from "../types/types";
import {getCountryMap, TypeCountryData} from "../config/countries";
import {cities, TypeCity} from "../config/cities";
/* Import classes. */
import {CoordinateConverter} from "./CoordinateConverter";
/* Import tools. */
import {getIdFromPlace} from "../tools/interaction";
/* Import data. */
import {countriesDataLow} from "../data/geoJsonLow";
import {countriesDataMedium} from "../data/geoJsonMedium";
import {countriesDataTiny} from "../data/geoJsonTiny";
import {getIdFromPlace} from "../tools/interaction";
import {classNameSvgCircle} from "../config/elementNames";
/* Import db and db types. */
import {getCities, TypeCity} from "../db/cities";
import {TypeCountryData} from "../db/countries";
interface DataConverterOptions {

@@ -26,14 +38,2 @@

private readonly propertyCountrySelectedFill: string = '#c0e0c0';
private readonly propertyCountrySelectedStroke: string = '#a0a0a0';
private readonly propertyCountrySelectedStrokeWidth: number = .1;
private readonly propertiesCityFill: string = '#008000';
private readonly propertiesCityStroke: string = '#008000';
private readonly propertiesCityStrokeWidth: number = 0.;
private readonly countryMap: TypeCountryData = getCountryMap();

@@ -112,3 +112,3 @@

convertedFeature.name = this.countryMap[country].nameDe;
convertedFeature.name = this.countryMap[country].translation.de;

@@ -152,3 +152,3 @@ return convertedFeature;

type: "Point",
coordinates: city.coordinate
coordinates: [city.coordinate.longitude, city.coordinate.latitude],
},

@@ -170,3 +170,2 @@ properties: {

* @param geoJson
* @see cities
*/

@@ -178,3 +177,3 @@ private addCities(geoJson: InterfaceGeoJson): InterfaceGeoJson {

cities.forEach((city) => {
getCities().forEach((city) => {
geoJson.features.push(this.getFeatureFromCity(city));

@@ -181,0 +180,0 @@ });

@@ -19,5 +19,6 @@ /* Import configuration. */

import {
distanceCityTypeNameCapital,
distanceCityTypeNameCity,
distanceCityTypeNameStateCapital,
getCityMap,
distanceCityTypeNameCapital, distanceCityTypeNameCity, distanceCityTypeNameStateCapital,
TypeCityType,
typeCityTypeNameCapital,

@@ -28,2 +29,5 @@ typeCityTypeNameCity,

/* Import db types. */
import {TypeCityType} from "../db/cities";
/* GeoJson2PathOptions interface. */

@@ -96,3 +100,3 @@ interface GeoJson2PathOptionsLazy {

const id = feature.id ? feature.id.toUpperCase() : 'XX';
const name = id.toLowerCase() in countryMap ? countryMap[id.toLowerCase()][languageName] : id;
const name = id.toLowerCase() in countryMap ? countryMap[id.toLowerCase()].translation[languageName] : id;

@@ -120,3 +124,3 @@ (coordinates as number[][][]).forEach(ring => {

const id = feature.id ? feature.id.toUpperCase() : 'XX';
const name = id.toLowerCase() in countryMap ? countryMap[id.toLowerCase()][languageName] : id;
const name = id.toLowerCase() in countryMap ? countryMap[id.toLowerCase()].translation[languageName] : id;

@@ -123,0 +127,0 @@ const multiPolygonPath = (coordinates as number[][][][]).map(polygon => {

/* Import configuration. */
import {getCountryMap, TypeCountry, TypeCountryData} from "../config/countries";
import {defaultDataSource} from "../config/config";

@@ -4,0 +3,0 @@ import {defaultLanguage} from "../../../config/config";

@@ -5,5 +5,10 @@ import React from "react";

/* Import configurations. */
import {getCityMap} from "../config/cities";
/* Import interfaces. */
import {Point} from "../config/interfaces";
import {getCityMap, TypeCity} from "../config/cities";
import {getCountryMap, TypeCountry} from "../config/countries";
/* Import db types. */
import {getCountryMap} from "../config/countries";
import {

@@ -29,2 +34,4 @@ classNameHover,

import {ucFirst} from "./string";
import {TypeCountry} from "../db/countries";
import {TypeCity} from "../db/cities";

@@ -31,0 +38,0 @@ /**

/* Import configurations. */
import {getCountryMap, TypeCountry} from "../config/countries";
import {TypeCity} from "../config/cities";
import {getCountryMap} from "../config/countries";

@@ -11,2 +10,6 @@ /* Import other tools. */

/* Import db types. */
import {TypeCountry, TypeCountryTranslation} from "../db/countries";
import {TypeCity, TypeCityTranslation} from "../db/cities";
/**

@@ -17,24 +20,21 @@ * Returns the language name of given language.

*/
export const getLanguageNameCountry = (language: string): keyof TypeCountry => {
/* Builds nameCz, nameDe, etc. */
const key = 'name' + language.charAt(0).toUpperCase() + language.slice(1);
export const getLanguageNameCountry = (language: string): keyof TypeCountryTranslation => {
/* Reference a real TypeCountryTranslation object structure for the check. */
const exampleTranslation: TypeCountryTranslation = {
cs: '',
de: '',
en: '',
es: '',
fr: '',
hr: '',
it: '',
pl: '',
sv: '',
};
/* Reference a real TypeCountry object structure for the check. */
const exampleCountry: TypeCountry = {
code: null,
language = language.toLowerCase();
nameCz: '',
nameDe: '',
nameEn: '',
nameEs: '',
nameFr: '',
nameHr: '',
nameIt: '',
namePl: '',
nameSv: '',
};
/* Check if key exists in exampleCountry */
if (key in exampleCountry) {
return key as keyof TypeCountry;
if (language in exampleTranslation) {
return language as keyof TypeCountryTranslation;
}

@@ -50,32 +50,21 @@

*/
export const getLanguageNamePlace = (language: string): keyof TypeCity => {
/* Builds nameCz, nameDe, etc. */
const key = 'name' + language.charAt(0).toUpperCase() + language.slice(1);
export const getLanguageNamePlace = (language: string): keyof TypeCityTranslation => {
/* Reference a real TypeCountry object structure for the check. */
const exampleCountry: TypeCity = {
coordinate: [.0, .0],
priority: 1,
size: 'smaller',
const exampleTranslation: TypeCityTranslation = {
cs: '',
de: '',
en: '',
es: '',
fr: '',
hr: '',
it: '',
pl: '',
sv: '',
};
country: '',
type: 'city',
language = language.toLowerCase();
name: '',
nameCz: '',
nameDe: '',
nameEn: '',
nameEs: '',
nameFr: '',
nameHr: '',
nameIt: '',
namePl: '',
nameSv: '',
population: 0
};
/* Check if key exists in exampleCountry */
if (key in exampleCountry) {
return key as keyof TypeCity;
if (language in exampleTranslation) {
return language as keyof TypeCityTranslation;
}

@@ -98,4 +87,4 @@

if (languageName in data) {
value = data[languageName];
if (languageName in data.translation) {
value = data.translation[languageName];
}

@@ -123,3 +112,3 @@

*/
export const getTranslation = (country: TypeCountryKey|null): TypeCountry|null => {
export const getTranslation = (country: TypeCountryKey|null): TypeCountryTranslation|null => {

@@ -138,3 +127,3 @@ if (country === null) {

return countryMap[country];
return countryMap[country].translation;
}

@@ -5,4 +5,6 @@ import { FeatureCollection } from 'geojson';

import {CountryData, PlaceData} from "../config/interfaces";
import {TypeCitySize, TypeCityType} from "../config/cities";
/* Import db types. */
import {TypeCitySize, TypeCityType} from "../db/cities";
export type TypeProperties = {

@@ -9,0 +11,0 @@ name?: string;

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet