ohm-js
Version:
14 lines (12 loc) • 327 B
JavaScript
import {Builder} from './Builder.js';
export 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);
}
}