Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
typed-usa-states
Advanced tools
An array of geographical data for all USA states with full TypeScript support
An array of geographical data for all USA states with full TypeScript support
This package contains geographical data for all USA states including:
name
of the stateabbreviation
of the stateterritory
: whether the state is under the sovereign jurisdiction of the federal government of the United Statescapital
city of the statecontiguous
: whether the state shares common borders with other stateszipCodes
: an array containing string arrays. Each array contains two elements (string) - the start and the end of the zip code range. (The string
type is used because TypeScript does not like numbers with leading zero. Pull request are welcome if you find a workaround for this issue.)area
: the area of the state in square miles in the following format:
year
: when was the value last updatedvalue
: the actual areapopulation
: the population of the state in the following format:
year
: when was the value last updatedcount
: the actual populationcounties
of the stateNB There is no counties information for the following US overseas territories:
If you happen to have any knowledge on the matter, please consider contributing!
This package provides data for all cities in the US.
You can use this by importing the cities array:
import { usaCities } from 'typed-usa-states';
Each city object contains the following data:
name
: the name of the citystate
: the state which the city belongs tonpm i typed-usa-states
# or
yarn add typed-usa-states
Since the size of the array is pretty big, you can choose which states data to import in your application.
There are several predefined exported arrays with data for the states.
Their content's schema is explained below:
import { usaStatesFull } from 'typed-usa-states';
Schema:
{
name: string,
abbreviation: string,
territory: boolean,
capital: string,
contiguous: boolean,
zipCodes: [string, string][],
area: {
year: number,
value: number
},
population: {
year: number,
count: number
},
counties: string[]
}
import { usaStates } from 'typed-usa-states';
Schema:
{
name: string,
abbreviation: string,
territory: boolean,
capital: string,
contiguous: boolean
}
import { usaStatesWithArea } from 'typed-usa-states';
Schema:
{
name: string,
abbreviation: string,
territory: boolean,
capital: string,
contiguous: boolean,
area: {
year: number,
value: number
}
}
import { usaStatesWithCounties } from 'typed-usa-states';
Schema:
{
name: string,
abbreviation: string,
territory: boolean,
capital: string,
contiguous: boolean,
counties: string[]
}
import { usaStatesWithPopulation } from 'typed-usa-states';
Schema:
{
name: string,
abbreviation: string,
territory: boolean,
capital: string,
contiguous: boolean,
population: {
year: number,
count: number
}
}
import { usaStatesWithZipCodes } from 'typed-usa-states';
Schema:
{
name: string,
abbreviation: string,
territory: boolean,
capital: string,
contiguous: boolean,
zipCodes: [string, string][]
}
import { usaCities } from 'typed-usa-states';
Schema:
{
city: string;
state: string;
}
You can use the module directly in the browser (without any module bundler such as Webpack or Parcel) but you will need to include requirejs
.
The usage is not so straight-forward, so please refer to the demo
typed-usa-states
exposes several pretty large arrays.
It is possible that you experience issues with insufficient memory when using create-react-app
or Webpack, Parcel, Rollup, etc. or if you are using the package in Docker or other CI environment.
In this case you might want to import the required array directly instead of relying on the module bunlder to resolve it for you.
This means that you need to change your code like this:
- import { usaStates } from 'typed-usa-states';
+ import { usaStates } from 'typed-usa-states/dist/states';
- import { usaCities } from 'typed-usa-states';
+ import { usaCities } from 'typed-usa-states/dist/cities';
- import { usaStatesFull } from 'typed-usa-states';
+ import { usaStatesFull } from 'typed-usa-states/dist/states-full';
- import { usaStatesWithArea } from 'typed-usa-states';
+ import { usaStatesWithArea } from 'typed-usa-states/dist/states-with-area';
- import { usaStatesWithCounties } from 'typed-usa-states';
+ import { usaStatesWithCounties } from 'typed-usa-states/dist/states-with-counties';
- import { usaStatesWithPopulation } from 'typed-usa-states';
+ import { usaStatesWithPopulation } from 'typed-usa-states/dist/states-with-population';
- import { usaStatesWithZipCodes } from 'typed-usa-states';
+ import { usaStatesWithZipCodes } from 'typed-usa-states/dist/states-with-zipcodes';
The package exports several types which can be used in TypeScript environment.
The typings are located in dist/index.d.ts
and are being auto detected by TypeScript.
MIT
FAQs
An array of geographical data for all USA states with full TypeScript support
The npm package typed-usa-states receives a total of 10,851 weekly downloads. As such, typed-usa-states popularity was classified as popular.
We found that typed-usa-states demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.