MCPcopy Create free account
hub / github.com/postlight/parser / extractResult

Function extractResult

src/extractors/root-extractor.js:187–202  ·  view source on GitHub ↗
(opts)

Source from the content-addressed store, hash-verified

185}
186
187function extractResult(opts) {
188 const { type, extractor, fallback = true } = opts;
189
190 const result = select({ ...opts, extractionOpts: extractor[type] });
191
192 // If custom parser succeeds, return the result
193 if (result) {
194 return result;
195 }
196
197 // If nothing matches the selector, and fallback is enabled,
198 // run the Generic extraction
199 if (fallback) return GenericExtractor[type](opts);
200
201 return null;
202}
203
204const RootExtractor = {
205 extract(extractor = GenericExtractor, opts) {

Callers 1

extractFunction · 0.85

Calls 1

selectFunction · 0.85

Tested by

no test coverage detected