UNPKG

enolib

Version:

The eno standard library

16 lines (13 loc) 635 B
const { Context } = require('./context.js'); const { Section } = require('./elements/section.js'); /** * Main parser entry point * @param {string} input The *content* of an eno document as a string * @param {object} options Optional parser settings * @param {object} options.locale A custom locale for error messages * @param {string} options.source A source label to include in error messages - provide (e.g.) a filename or path to let users know in which file the error occured. */ exports.parse = (input, options = {}) => { const context = new Context(input, options); return new Section(context, context._document); };