Skip to main content
Module

x/ohm_js/src/makeRecipe.js

A library and language for building parsers, interpreters, compilers, etc.
Go to Latest
File
'use strict';
// --------------------------------------------------------------------// Imports// --------------------------------------------------------------------
const Builder = require('./Builder');
// --------------------------------------------------------------------// Private stuff// --------------------------------------------------------------------
function makeRecipe(recipe) { if (typeof recipe === 'function') { return recipe.call(new Builder()); } else { if (typeof recipe === 'string') { // stringified JSON recipe recipe = JSON.parse(recipe); } return new Builder().fromRecipe(recipe); }}
// --------------------------------------------------------------------// Exports// --------------------------------------------------------------------
exports.makeRecipe = makeRecipe;