
Research
/Security News
Mini Shai-Hulud Campaign Hits Red Hat Cloud Services npm Packages
A mini Shai-Hulud campaign compromised Red Hat Cloud Services npm packages to steal developer and CI/CD secrets during installation.
bibtex-parse
Advanced tools
Parse BibTeX to JSON.
npm install bibtex-parse
const bibtexParse = require('bibtex-parse');
const fs = require('fs');
const bibtex = fs.readFileSync('example.bib', 'utf8');
bibtexParse.entries(bibtex);
example.bib:
@preamble{"Reference list"}
@string{ian = "Brown, Ian"}
@string{jane = "Woods, Jane"}
%references
@inproceedings{Smith2009,
author=jane,
year=2009,
month=dec,
title={{Quantum somethings}},
journal={Journal of {B}lah}
}
@book{IP:1990,
author = ian # " and " # jane,
year = {1990},
title = {Methods for Research}
}
output:
[
{
"key": "Smith2009",
"type": "inproceedings",
"AUTHOR": "Woods, Jane",
"YEAR": 2009,
"MONTH": "December",
"TITLE": "Quantum somethings",
"JOURNAL": "Journal of Blah"
},
{
"key": "IP:1990",
"type": "book",
"AUTHOR": "Brown, Ian and Woods, Jane",
"YEAR": "1990",
"TITLE": "Methods for Research"
}
]
Note: fields are always output in capitals to distinguish from build in attributes (key and type).
To get the AST, use:
bibtexParse.parse(bibtex, options);
Where bibtex is a string representing bibtex to be parsed, and options an object with any of the following:
number: tells the parser how numbers should be returned.
number: "auto" (default): return a JavaScript number, unless over MAX_SAFE_INTEGER (9007199254740991), in which case a BigInt is returned.number: "number": always return a JavaScript number, even if over MAX_SAFE_INTEGER (in which case the precision will be lost).number: "bigint": always return a BigInt.number: "string": return number as a string.This will return an array of items. There are four types of item:
{ itemtype: 'string', name, value, datatype, enclosed }{ itemtype: 'preamble', value, datatype, enclosed }{ itemtype: 'comment', comment }{ itemtype: 'entry', type, key, enclosed, fields },
type: e.g. article, inproceedings, bookkey: the unique identifier for the entryfields: e.g. title, year [{ name: 'year', value: 2001, datatype: 'number' }, ...]Datatype can be one of the following:
number: an integer numberidentifier: a string variable namebraced: a value which was enclosed in curly bracesquoted: a value which was enclosed in double quotesconcatinate: in which case the corresponding value property will be an array [{ datatype, value }, ...]null: used when no value has been assigned, e.g. @string{a}unenclosed: used when a preamble has not been properly enclosed (e.g @preamble{this isn't enclosed}).Enclosed can be one of the following:
braces - when item is enclosed in curly braces (e.g. @string{a = 1})parentheses - when item is enclosed in brackets (e.g. @string(a = 1))[
{
"itemtype": "preamble",
"enclosed": "braces",
"value": "Reference list",
"datatype": "quoted"
},
{ "itemtype": "comment", "comment": "\n" },
{
"itemtype": "string",
"name": "ian",
"value": "Brown, Ian",
"datatype": "quoted"
},
{ "itemtype": "comment", "comment": "\n" },
{
"itemtype": "string",
"name": "jane",
"value": "Woods, Jane",
"datatype": "quoted"
},
{ "itemtype": "comment", "comment": "\n%references\n" },
{
"itemtype": "entry",
"type": "inproceedings",
"enclosed": "braces",
"key": "Smith2009",
"fields": [
{ "name": "author", "value": "jane", "datatype": "identifier" },
{ "name": "year", "value": 2009, "datatype": "number" },
{ "name": "month", "value": "dec", "datatype": "identifier" },
{
"name": "title",
"value": "{Quantum somethings}",
"datatype": "braced"
},
{ "name": "journal", "value": "Journal of {B}lah", "datatype": "braced" }
]
},
{ "itemtype": "comment", "comment": "\n\n" },
{
"itemtype": "entry",
"type": "inproceedings",
"enclosed": "braces",
"key": "Smith2009",
"fields": [
{ "name": "author", "value": "jane", "datatype": "identifier" },
{ "name": "year", "value": 2009, "datatype": "number" },
{ "name": "month", "value": "dec", "datatype": "identifier" },
{
"name": "title",
"value": "{Quantum somethings}",
"datatype": "braced"
},
{ "name": "journal", "value": "Journal of {B}lah", "datatype": "braced" }
]
}
]
FAQs
bibtex parser for javascript
We found that bibtex-parse demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Research
/Security News
A mini Shai-Hulud campaign compromised Red Hat Cloud Services npm packages to steal developer and CI/CD secrets during installation.

Research
/Security News
The North Korean malware loader hides in a Packagist-listed package and its GitHub branch to fetch and execute remote code in a likely Contagious Interview-style lure.

Security News
The Rust project is moving toward formal rules on LLM use in contributions after months of internal debate over maintainer burden, code quality, and contributor experience.