read-gedcom
Version:
Gedcom file reader
17 lines • 649 B
JavaScript
import { parseGedcom } from '../parse';
import { SelectionGedcom } from './internal';
/**
* Parses a Gedcom file with {@link parseGedcom} and wraps the result in a {@link SelectionGedcom}.
* @param buffer The content of the file
* @param options Optional parameters
*/
export const readGedcom = (buffer, options = {}) => {
const rootNode = parseGedcom(buffer, options);
return new SelectionGedcom(rootNode, [rootNode]);
};
/**
* Wrap a Gedcom tree into a {@link SelectionGedcom}.
* @param rootNode The Gedcom tree
*/
export const selectGedcom = (rootNode) => new SelectionGedcom(rootNode, [rootNode]);
//# sourceMappingURL=read.js.map