index.js
function headingRange(node, options, callback) {
  var test = options
  var ignoreFinalDefinitions = false

  // Object, not regex.
  if (test && typeof test === 'object' && !('exec' in test)) {
    ignoreFinalDefinitions = test.ignoreFinalDefinitions === true
    test = test.test
  }

  if (typeof test === 'string') {
    test = toExpression(test)
  }

  // Regex
  if (test && 'exec' in test) {
    test = wrapExpression(test)
  }

  if (typeof test !== 'function') {
    throw new Error(
      'Expected `string`, `regexp`, or `function` for `test`, not `' +
        test +
        '`'
    )
  }

  search(node, test, ignoreFinalDefinitions, callback)
}
function headingRange(node, options, callback) {
  var test = options
  var ignoreFinalDefinitions = false

  // Object, not regex.
  if (test && typeof test === 'object' && !('exec' in test)) {
    ignoreFinalDefinitions = test.ignoreFinalDefinitions === true
    test = test.test
  }

  if (typeof test === 'string') {
    test = toExpression(test)
  }

  // Regex
  if (test && 'exec' in test) {
    test = wrapExpression(test)
  }

  if (typeof test !== 'function') {
    throw new Error(
      'Expected `string`, `regexp`, or `function` for `test`, not `' +
        test +
        '`'
    )
  }

  search(node, test, ignoreFinalDefinitions, callback)
}
function headingRange ( node , options , callback ) { var test = options var ignoreFinalDefinitions = false // Object, not regex. if ( test && typeof test === 'object' && ! ( 'exec' in test ) ) { ignoreFinalDefinitions = test . ignoreFinalDefinitions === true test = test . test } if ( typeof test === 'string' ) { test = toExpression ( test ) } // Regex if ( test && 'exec' in test ) { test = wrapExpression ( test ) } if ( typeof test !== 'function' ) { throw new Error ( 'Expected `string`, `regexp`, or `function` for `test`, not `' + test + '`' ) } search ( node , test , ignoreFinalDefinitions , callback ) }
Search `node` with `options` and invoke `callback`.
Search node with options and invoke callback .