tfk-dsf-normalize-contact

3.1.3 • Public • Published

Build Status Coverage Status Code Climate js-standard-style

tfk-dsf-normalize-contact

Maps contact information from dsf to something more useful

Installation

From npm

$ npm install tfk-dsf-normalize-contact

From GitHub

$ git clone 

cd into directory and run setup

$ npm install

Usage

const normalizeContact = require('tfk-dsf-normalize-contact')
const dsf = {
  'FODT': '181171',
  'PERS': '12345',
  'INR': '18117108976',
  'FODTAR': '1971',
  'STAT-KD': '1',
  'STAT': 'BOSATT',
  'NAVN-S': 'GRÅ',
  'NAVN-F': 'GANDALF',
  'NAVN-M': 'GEORG',
  'NAVN': 'GRÅ GANDALF GEORG',
  'ADR': 'FYLKESBAKKEN 10',
  'POSTN': '3715',
  'POSTS': 'SKIEN',
  'SPES-KD': '0',
  'SPES': 'VANLIG BOSATT',
  'KJONN': 'M',
  'STAT': 'BOSATT',
  'MOR-FODT': '010166',
  'MOR-PERS': '33333',
  'FAR-FODT': '020265',
  'FAR-PERS': '11111',
  'Barn': [
        {
          'BAR-FODT': '020280',
          'BAR-PERS': '99999',
          'BAR-INR': '02028099999',
          'BAR-KJO': 'M'
        },
        {
          'BAR-FODT': '040481',
          'BAR-PERS': '88888',
          'BAR-INR': '04048166666',
          'BAR-KJO': 'K'
        }
      ],
}
 
console.log(normalizeContact(dsf))
 

Returns

{
  'personalIdNumber': '24069844444',
  'birthDate': '1998-06-24',
  'firstName': 'Gandalf',
  'middleName': 'Georg',
  'lastName': 'Grå',
  'fullName': 'Gandalf Georg Grå',
  'address': 'Oppfunnet Gate 30',
  'zip': '3717',
  'city': 'Skien',
  'gender': 'Male',
  'alive': true,
  'motherIdNumber': '01016633333',
  'fatherIdNumber': '02026511111',
  'spouseIdNumber': '',
  'children':
  [
    { 'childIdNumber': '02028099999' },
    { 'childIdNumber': '04048188888' }
  ]
}

License

MIT

Package Sidebar

Install

npm i tfk-dsf-normalize-contact

Weekly Downloads

12

Version

3.1.3

License

MIT

Unpacked Size

11.2 kB

Total Files

14

Last publish

Collaborators

  • zrrrzzt
  • maccyber
  • sherex
  • matsand
  • runely