A powerful library for parsing various academic reference file formats in Node.js.
npm install biblibA powerful library for parsing various academic reference file formats in Node.js.
- Parse multiple reference file formats:
- RIS (Research Information Systems)
- Medline
- EndNote XML
- BibTeX
- CSV
- Standardized output format for all parsers
- TypeScript support with full type definitions
- Configurable parsing options
- Author name normalization
- DOI handling and validation
- Page number formatting
``bash`
npm install biblib
`typescript
import {
parseRIS,
parseMedline,
parseEndnoteXML,
parseBibTeX,
parseCSV,
} from 'biblib';
// Parse RIS file
const risRefs = await parseRIS(risContent, {
defaultType: 'journalArticle',
delimeter: '\r',
});
// Parse Medline file
const medlineRefs = await parseMedline(medlineContent, {
reformatAuthors: true,
journal: 'long',
parseAddress: true,
});
// Parse EndNote XML file
const endnoteRefs = await parseEndnoteXML(xmlContent, {
defaultType: 'journalArticle',
});
// Parse BibTeX file
const bibtexRefs = await parseBibTeX(bibtexContent, {
removeComments: true,
defaultType: 'journalArticle',
});
// Parse CSV file
const csvRefs = await parseCSV(csvContent, {
defaultType: 'journalArticle',
});
`
All parsers return references in a standardized format:
`typescript`
interface BibLibRef {
type?: string;
title?: string;
authors?: string[];
journal?: string;
year?: string;
volume?: string;
number?: string;
pages?: string;
doi?: string;
urls?: string[];
abstract?: string;
keywords?: string[];
date?: string;
isbn?: string;
language?: string;
notes?: string;
label?: string;
[key: string]: any;
}
`typescript`
parseRIS(content: string, options?: {
defaultType?: string; // Default: 'journalArticle'
delimeter?: string; // Default: '\r'
}): Promise
`typescript`
parseMedline(content: string, options?: {
defaultType?: string; // Default: 'journalArticle'
delimeter?: string; // Default: '\r'
reformatAuthors?: boolean; // Default: true
journal?: 'long' | 'short'; // Default: 'long'
parseAddress?: boolean; // Default: true
parseDoi?: boolean; // Default: true
parseYear?: boolean; // Default: true
}): Promise
`typescript`
parseEndnoteXML(content: string, options?: {
defaultType?: string; // Default: 'journalArticle'
}): Promise
`typescript`
parseBibTeX(content: string, options?: {
removeComments?: boolean; // Default: true
defaultType?: string; // Default: 'journalArticle'
delimeter?: string; // Default: '\n'
}): Promise
`typescript``
parseCSV(content: string, options?: {
defaultType?: string; // Default: 'journalArticle'
}): Promise
The library automatically normalizes author names into a consistent format (A. Azlan):
- Handles various input formats (Firstname Lastname, Lastname, Firstname, etc.)
- Properly handles middle names and initials
- Preserves suffixes (Jr., Sr., III, etc.)
- Automatically adds 'doi.org' prefix when missing
- Validates DOI format
- Removes common prefixes (doi:, http://dx.doi.org/, etc.)
- Standardizes page number formats (e.g., "123-129", "123--129", "123 to 129")
- Handles single page numbers
- Preserves complex page numbers when needed
MIT
Contributions are welcome! Please feel free to submit a Pull Request.