1.0.1 • Published 8 years ago

generate-gedcom v1.0.1

Weekly downloads
3
License
WTFPL
Repository
github
Last release
8 years ago

Given a data structure, generate GEDCOM text output.

This module expects the data structure output by the parse-gedcom library.

npm i generate-gedcom -S
const astToGedcom = require('generate-gedcom')

This module exports a single function that takes an array of GEDCOM data and returns a string.

Example

const input = [ { pointer: '',
    tag: 'HEAD',
    data: '',
    tree:
     [ { pointer: '',
         tag: 'SOUR',
         data: 'Millennial Children',
         tree: [ { pointer: '', tag: 'VERS', data: 'V5.5', tree: [] } ] },
       { pointer: '', tag: 'CHAR', data: 'UNICODE', tree: [] } ] },
  { pointer: '@I1@',
    tag: 'INDI',
    data: '',
    tree: [ { pointer: '', tag: 'NAME', data: 'Pie /Cakeson/', tree: [] } ] } ]

const expectedOutput = `0 HEAD
1 SOUR Millennial Children
2 VERS V5.5
1 CHAR UNICODE
0 @I1@ INDI
1 NAME Pie /Cakeson/`

astToGedcom(input) // => expectedOutput

License

WTFPL