Skip to content

Instantly share code, notes, and snippets.

@SaraVieira
Last active October 24, 2018 16:17
Show Gist options
  • Save SaraVieira/f932af566a9fca8e7afcb038591e2e5b to your computer and use it in GitHub Desktop.
Save SaraVieira/f932af566a9fca8e7afcb038591e2e5b to your computer and use it in GitHub Desktop.
const isImage = value => {
if (typeof value !== "string") throw new GraphQLError("Value passed is not a string");
const extension = path.extname(value).slice(1);
if (imageExtensions.includes(extension)) return value;
throw new GraphQLError("Value passed is not an Image");
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment