omission.js 419 B

123456789101112131415161718
  1. 'use strict'
  2. module.exports = omission
  3. var own = {}.hasOwnProperty
  4. /* Factory to check if a given node can have a tag omitted. */
  5. function omission(handlers) {
  6. return omit
  7. /* Check if a given node can have a tag omitted. */
  8. function omit(node, index, parent) {
  9. var name = node.tagName
  10. var fn = own.call(handlers, name) ? handlers[name] : false
  11. return fn ? fn(node, index, parent) : false
  12. }
  13. }