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

i18n-postal-address

Package Overview
Dependencies
Maintainers
1
Versions
23
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

i18n-postal-address - npm Package Compare versions

Comparing version 0.0.1-security to 0.0.2

.eslintrc.json

36

package.json
{
"name": "i18n-postal-address",
"version": "0.0.1-security",
"description": "security holding package",
"repository": "npm/security-holder",
"dependencies": {}
"version": "0.0.2",
"description": "A JavaScript library to produce international postal addresses formatted by region",
"main": "dist/postal-address.js",
"directories": {
"lib": "lib"
},
"scripts": {
"test": "./test/test.js",
"build": "NODE_ENV=production webpack --mode production"
},
"repository": {
"type": "git",
"url": "git+https://github.com/joaocarmo/i18n-postal-address.git"
},
"keywords": [
"i18n",
"postal",
"address",
"formatter",
"web"
],
"author": "Joao Carmo",
"license": "MIT",
"bugs": {
"url": "https://github.com/joaocarmo/i18n-postal-address/issues"
},
"homepage": "https://github.com/joaocarmo/i18n-postal-address#readme",
"devDependencies": {
"eslint": "^5.0.1",
"webpack": "^4.14.0",
"webpack-cli": "^3.0.8"
}
}

@@ -1,9 +0,152 @@

# Security holding package
# i18n-postal-address
A JavaScript library to produce international postal addresses formatted by
region
This package name is not currently in use, but was formerly occupied
by another package. To avoid malicious use, npm is hanging on to the
package name, but loosely, and we'll probably give it to you if you
want it.
## Installation
You may adopt this package by contacting support@npmjs.com and
requesting the name.
```
$ npm install i18n-postal-address
```
## Usage
#### On the web
It's exposed through the _window_ global object as explained below.
`index.html`
```html
<head>
<script type="text/javascript" src="./postal-address.js"></script>
<script type="text/javascript" src="./foo.js"></script>
</head>
```
`foo.js`
```javascript
// define myAddress
var PostalAddress = window.PostalAddress.PostalAddress;
var myAddress = new PostalAddress();
// ...
```
#### With a bundler / Node.js
With a bundler (e.g. webpack) or in Node.js you can just require / import it.
```javascript
import { PostalAddress } from 'i18n-postal-address'
// define myAddress
const myAddress = new PostalAddress()
```
## Example
```javascript
const myAddressPersonal = new PostalAddress()
myAddressPersonal.setAddress1('Rua do Pastel, 19')
myAddressPersonal.setCity('Aveiro')
myAddressPersonal.setCountry('Brazil')
myAddressPersonal.setFirstName('John')
myAddressPersonal.setHonorific('Mr.')
myAddressPersonal.setLastName('Pestana')
myAddressPersonal.setPostalCode('2700-242')
myAddressPersonal.setSecondName('Lopes')
myAddressPersonal.setOutputFormat('array')
myAddressPersonal.setFormat({
country: 'AR',
type: 'personal',
})
console.log(myAddressPersonal.output())
console.log(myAddressPersonal.toString())
```
`output()`
```
[ [ 'Mr.', 'John', 'Lopes' ],
[ 'Pestana' ],
[ 'Rua do Pastel, 19' ],
[ '2700-242', 'Aveiro' ],
[ 'Brazil' ] ]
```
`toString()`
```
Mr. John Lopes
Pestana
Rua do Pastel, 19
2700-242 Aveiro
Brazil
```
## Available Class Methods
**Address Attributes**
```
setAddress1
setAddress2
setAddressNum
setCity
setCompanyName
setCountry
setDo
setDong
setFirstLastName
setFirstName
setGu
setHonorific
setJobTitle
setLastName
setPostalCode
setPrefecture
setProvince
setRegion
setRepublic
setSecondLastName
setSecondName
setSi
setState
setTitle
```
**Options**
These affect the output format
```javascript
// country: 'CA', ...
// type: 'business', 'english', 'default', 'french', 'personal'
setFormat({ country, type })
```
### Why?
The great [libpostal](https://github.com/openvenues/libpostal) is not available
on the web.
Need to present postal addresses for different regions worldwide stored in
individual parts (company name, address, postal code, city, county, country,
...).
### Inspiration
**Disclaimer:** It doesn't mean this library tries to recreate any of these
MSDN > ... > Globalization and Localization > [Appendix V International Address Formats](https://msdn.microsoft.com/en-us/library/cc195167.aspx)
[Query Address Data](http://i18napis.appspot.com/address)
[PostalAddress](https://schema.org/PostalAddress)
### Forking / Contributing
Build
```
$ npm run build
```
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc