Sha256: 47d42d06f39ce1ff6737a74d63076adce3aa047db84b1249d2efa6fed89e371e

Contents?: true

Size: 747 Bytes

Versions: 1

Compression:

Stored size: 747 Bytes

Contents

'use strict'

var convert = require('unist-util-is/convert')

module.exports = findAllAfter

function findAllAfter(parent, index, test) {
  var is = convert(test)
  var results = []

  if (!parent || !parent.type || !parent.children) {
    throw new Error('Expected parent node')
  }

  if (typeof index === 'number') {
    if (index < 0 || index === Infinity) {
      throw new Error('Expected positive finite number as index')
    }
  } else {
    index = parent.children.indexOf(index)

    if (index < 0) {
      throw new Error('Expected child node or index')
    }
  }

  while (++index < parent.children.length) {
    if (is(parent.children[index], index, parent)) {
      results.push(parent.children[index])
    }
  }

  return results
}

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
trusty-cms-6.3.1 node_modules/unist-util-find-all-after/index.js