function enrichCore()

in src/core.js [154:181]


function enrichCore(core, parser) {
  // add builders and types to the function for simple access
  Object.assign(core, recast.types.namedTypes);
  Object.assign(core, recast.types.builders);
  core.registerMethods = Collection.registerMethods;
  /**
  * @augments core
  * @type external:astTypes
  */
  core.types = recast.types;
  core.match = match;
  core.template = template(parser);

  // add mappings and filters to function
  core.filters = {};
  core.mappings = {};
  for (const name in collections) {
    if (collections[name].filters) {
      core.filters[name] = collections[name].filters;
    }
    if (collections[name].mappings) {
      core.mappings[name] = collections[name].mappings;
    }
  }
  core.use = use;
  core.withParser = withParser;
  return core;
}