plugins/ant-graphql/functions/mock.js
function mock (_, mockArgs, fieldArgs, currentValue) {
  if (currentValue !== undefined) {
    return currentValue;
  }
  if (mockArgs && mockArgs.with) {
    if (fieldArgs) {
      try {
        return Mustache.render(mockArgs.with, fieldArgs);
      } catch (e) {
        logger.error(new AntError(
          'Coould not renderize field template',
          e
        ));
      }
    } else {
      return mockArgs.with;
    }
  }
  return null;
}
function mock (_, mockArgs, fieldArgs, currentValue) {
  if (currentValue !== undefined) {
    return currentValue;
  }
  if (mockArgs && mockArgs.with) {
    if (fieldArgs) {
      try {
        return Mustache.render(mockArgs.with, fieldArgs);
      } catch (e) {
        logger.error(new AntError(
          'Coould not renderize field template',
          e
        ));
      }
    } else {
      return mockArgs.with;
    }
  }
  return null;
}
function mock ( _ , mockArgs , fieldArgs , currentValue ) { if ( currentValue !== undefined ) { return currentValue ; } if ( mockArgs && mockArgs . with ) { if ( fieldArgs ) { try { return Mustache . render ( mockArgs . with , fieldArgs ) ; } catch ( e ) { logger . error ( new AntError ( 'Coould not renderize field template' , e ) ) ; } } else { return mockArgs . with ; } } return null ; }
This function mocks a GraphQL field value.
This function mocks a GraphQL field value .