import { annotationUtils , MockPlugin , Fetcher } from '@manta-style/core' ; import * as fetch from 'isomorphic-fetch' ; const qotdPlugin = { name : 'qotd' , mock : { StringType ( annotations ) { const jsdocRange = annotationUtils . getAnnotationsByKey ( 'qotd' , annotations ) ; if ( jsdocRange . length === 0 ) { return null ; } try { return new Fetcher ( fetch ( 'https://favqs.com/api/qotd' ) . then ( ( response ) => response . json ( ) ) . then ( ( json ) => json . quote . body ) ) ; } catch ( e ) { return null ; } } , } , } ; export default qotdPlugin ;