/* istanbul ignore file */importinspectfrom'../jsutils/inspect';importprintPathArrayfrom'../jsutils/printPathArray';import{pathToArray}from'../jsutils/Path';import{GraphQLError}from'../error/GraphQLError';import{coerceInputValue}from'./coerceInputValue';/** * Deprecated. Use coerceInputValue() directly for richer information. * * This function will be removed in v15 */exportfunctioncoerceValue(inputValue,type,blameNode,path){varerrors=[];varvalue=coerceInputValue(inputValue,type,function(errorPath,invalidValue,error){varerrorPrefix='Invalid value '+inspect(invalidValue);varpathArray=[].concat(pathToArray(path),errorPath);if(pathArray.length>0){errorPrefix+=" at \"value".concat(printPathArray(pathArray),"\"");}errors.push(newGraphQLError(errorPrefix+': '+error.message,blameNode,undefined,undefined,undefined,error.originalError));});returnerrors.length>0?{errors:errors,value:undefined}:{errors:undefined,value:value};}