MCPcopy Create free account
hub / github.com/TruthHun/BookStack / filterValue

Function filterValue

static/word2md/turndown.js:358–369  ·  view source on GitHub ↗
(rule, node, options)

Source from the content-addressed store, hash-verified

356}
357
358function filterValue (rule, node, options) {
359 var filter = rule.filter;
360 if (typeof filter === 'string') {
361 if (filter === node.nodeName.toLowerCase()) return true
362 } else if (Array.isArray(filter)) {
363 if (filter.indexOf(node.nodeName.toLowerCase()) > -1) return true
364 } else if (typeof filter === 'function') {
365 if (filter.call(rule, node, options)) return true
366 } else {
367 throw new TypeError('`filter` needs to be a string, array, or function')
368 }
369}
370
371/**
372 * The collapseWhitespace function is adapted from collapse-whitespace

Callers 1

findRuleFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected