@opuscapita/electronic-address
Advanced tools
{ | ||
"name": "@opuscapita/electronic-address", | ||
"version": "0.0.1", | ||
"version": "0.0.2", | ||
"description": "Library for decoding and encoding electronic addresses", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -12,13 +12,13 @@ # electronic-address | ||
``` | ||
Perform a validation by doing: | ||
Examples to decode and encode electronic addresses: | ||
```JS | ||
const electronicAddress = require('@opuscapita/electronic-address'); | ||
// encode an electronic invoice | ||
// decode an electronic invoice | ||
electronicAddress.decode('9930:DE12345678542'); | ||
// returns object { type: 'vat', value: 'DE123456785', ext: '42' } | ||
// validate a VAT number | ||
// encode an electronic invoice | ||
electronicAddress.encode({ type: 'gln', value: '4324565678967' }); | ||
// returns '0088:4324565678967' | ||
``` |
@@ -8,3 +8,3 @@ 'use strict' | ||
describe('#decode()', function() { | ||
it('should return decoded address containing VAT', function() { | ||
it('should return decoded address containing a VAT code', function() { | ||
assert.deepEqual(electronicAddress.decode('9930:DE282128819'), { type: 'vat', value: 'DE282128819', ext: null }); | ||
@@ -17,3 +17,3 @@ assert.deepEqual(electronicAddress.decode('9927:CHE-102.232.12546'), { type: 'vat', value: 'CHE102232125', ext: '46' }); | ||
it('should return decoded address containing GLN', function() { | ||
it('should return decoded address containing GLN code', function() { | ||
assert.deepEqual(electronicAddress.decode('0088:3569326752346'), { type: 'gln', value: '3569326752346', ext: null }); | ||
@@ -23,3 +23,3 @@ assert.deepEqual(electronicAddress.decode('0088:356932-675234642'), { type: 'gln', value: '3569326752346', ext: '42' }); | ||
it('should return decoded address containing OVT', function() { | ||
it('should return decoded address containing OVT code', function() { | ||
assert.deepEqual(electronicAddress.decode('0037:35693267'), { type: 'ovt', value: '003735693267', ext: null }); | ||
@@ -26,0 +26,0 @@ assert.deepEqual(electronicAddress.decode('0037:35693267523467'), { type: 'ovt', value: '00373569326752346', ext: '7' }); |
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 not supported yet
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 not supported yet
Sorry, the diff of this file is not supported yet
85761
0.05%