node-postcode
Advanced tools
Comparing version 0.0.1 to 0.0.2
{ | ||
"name": "node-postcode", | ||
"version": "0.0.1", | ||
"description": "API Wrapper for the Postcode.nl API. Supports gathering addresses from postcode and house number, verifying address data and the iDEAL API", | ||
"main": "index.js", | ||
"version": "0.0.2", | ||
"description": "API wrapper for the Postcode.nl APIs", | ||
"main": "lib/postcode.js", | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
"compile": "babel --presets es2015,stage-0 -d lib/ src/", | ||
"prepublish": "npm run compile", | ||
"test": "npm run compile && mocha test/test.js --recursive --compilers js:babel-core/register" | ||
}, | ||
@@ -13,3 +15,3 @@ "repository": { | ||
}, | ||
"author": "Ruben Rutten", | ||
"author": "Ruben Rutten <ruben@rubenrutten.nl>", | ||
"license": "MIT", | ||
@@ -19,3 +21,12 @@ "bugs": { | ||
}, | ||
"homepage": "https://github.com/Cyberuben/node-postcode#readme" | ||
"homepage": "https://github.com/Cyberuben/node-postcode#readme", | ||
"devDependencies": { | ||
"babel-cli": "^6.10.1", | ||
"babel-core": "^6.9.1", | ||
"babel-polyfill": "^6.9.1", | ||
"babel-preset-es2015": "^6.9.0", | ||
"babel-preset-stage-0": "^6.5.0", | ||
"chai": "^3.5.0", | ||
"mocha": "^2.5.3" | ||
} | ||
} |
# node-postcode | ||
API Wrapper for the Postcode.nl API. Supports gathering addresses from postcode and house number, verifying address data and the iDEAL API | ||
API wrapper for the Postcode.nl API. | ||
Features: | ||
- gathering addresses using postcode, house number and house number addition | ||
- verifying address data | ||
- processing iDEAL payments | ||
# Example | ||
``` | ||
var Postcode = require("node-postcode").Postcode; | ||
var client = new Postcode({ | ||
key: /* your API key */, | ||
secret: /* your API secret */ | ||
}); | ||
client.address("1111AA", 1) | ||
.then(function (addressDetails) { | ||
/* addressDetails contains information about the address (if valid) */ | ||
}); | ||
``` | ||
# Installation | ||
``` | ||
$ npm i node-postcode | ||
``` | ||
You can retrieve your own API credentials [over here](https://account.postcode.nl/registreer) (only available in Dutch at time of writing). | ||
# API Reference | ||
## PostcodeClient (Class) | ||
The client exposing the `address` and `signal` functions | ||
### new PostcodeClient(`options`) | ||
- **Arguments** | ||
- `options` - An object containing `key` and `secret` (required) | ||
- **Example** | ||
``` | ||
new PostcodeClient({ | ||
key: "YOUR_KEY", | ||
secret: "YOUR_SECRET" | ||
}); | ||
``` | ||
- **Returns** | ||
An instance of the `PostcodeClient` class | ||
### PostcodeClient.address(`postcode`, `number`[, `numberAddition`]) | ||
- **Arguments** | ||
- `postcode` - `required` A postcode in the format `1111AA` (4 digits, 2 letters). Can not start with a 0. Letters do not have to be in uppercase as these will be forced to uppercase when making the API call. `1111 AA` is also accepted, as spaces in the string are removed | ||
- `number` - `required` An integer in the range of 0 - 99999 | ||
- `numberAddition` - An addition to the `number`. Can indicate which apartment, room, office | ||
- **Example** | ||
``` | ||
client.address("1111AA", 1) | ||
.then(function (addressDetails) { | ||
/* | ||
addressDetails = { street: 'Diemerkade', | ||
houseNumber: 1, | ||
houseNumberAddition: '', | ||
postcode: '1111AA', | ||
city: 'Diemen', | ||
municipality: 'Diemen', | ||
province: 'Noord-Holland', | ||
rdX: 125497, | ||
rdY: 483727, | ||
latitude: 52.34067657, | ||
longitude: 4.95429501, | ||
bagNumberDesignationId: '0384200000016667', | ||
bagAddressableObjectId: '0384010000016511', | ||
addressType: 'building', | ||
purposes: [ 'residency' ], | ||
surfaceArea: 64, | ||
houseNumberAdditions: [ '' ] } | ||
*/ | ||
}) | ||
.catch(function (err) { | ||
/* Err will contain the error returned by either the API or the HTTP request */ | ||
}); | ||
``` | ||
- **Returns** | ||
Returns a `Promise`. When successful, `.then(function (addressDetails) {})` is returned. The format and explanation of the returned data can be found [at the official documentation](https://api.postcode.nl/documentation/address-api) of the API. When an error occurs, `.catch(function (err) {})` contains the error given. When `err.code == "PostcodeNl_Service_PostcodeAddress_AddressNotFoundException"`, the `postcode` and `number` supplied do not resolve to an address. | ||
When `numberAddition` is supplied, but `houseNumberAddition` is an empty string, the `numberAddition` can not be verified, but this does not mean that mail sent to this address will not be accepted. |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
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
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 2 instances in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
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 tests
QualityPackage does not have any tests. This is a strong signal of a poorly maintained or low quality package.
Found 1 instance in 1 package
28329
9
244
1
94
7
2
2