i18n-postal-address
Advanced tools
Comparing version 0.0.1-security to 0.0.2
{ | ||
"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" | ||
} | ||
} |
157
README.md
@@ -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 | ||
``` |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
Known malware
Supply chain riskThis package is malware. We have asked the package registry to remove it.
Found 1 instance in 1 package
Empty package
Supply chain riskPackage does not contain any code. It may be removed, is name squatting, or the result of a faulty package publish.
Found 1 instance in 1 package
No contributors or author data
MaintenancePackage does not specify a list of contributors or an author in package.json.
Found 1 instance in 1 package
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
No License Found
License(Experimental) License information could not be found.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
No website
QualityPackage does not have a website.
Found 1 instance in 1 package
51853
14
0
1286
0
1
153
0
0
3
2