Introduce getDefinitionName

This commit is contained in:
Chi Vinh Le
2017-04-26 01:07:07 +07:00
parent f79af56468
commit df2c33ac35
4 changed files with 22 additions and 11 deletions
+8
View File
@@ -29,3 +29,11 @@ export const getMyActionSummary = (type, comment) => {
export const getActionSummary = (type, comment) => {
return comment.action_summaries.filter(a => a.__typename === type);
};
/**
* Get name of first (or $pos-th) definition
*/
export function getDefinitionName(doc, pos = 0) {
return doc.definitions[pos].name.value;
}