Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
extendNodeType () {
return {
content: {
type: GraphQLString,
resolve: node => this._nodeToHTML(node)
},
headings: {
type: new GraphQLList(HeadingType),
args: {
depth: { type: HeadingLevels },
stripTags: { type: GraphQLBoolean, defaultValue: true }
},
resolve: async (node, { depth, stripTags }) => {
const key = cacheKey(node, 'headings')
let headings = cache.get(key)
if (!headings) {
const ast = await this._nodeToAST(node)
headings = findHeadings(ast)
cache.set(key, headings)
}
return headings
.filter(heading =>