Package Exports
- unist-util-find-all-before
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (unist-util-find-all-before) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
unist-util-find-all-before

Unist utility to find nodes before another node.
Installation
npm:
npm install unist-util-find-all-beforeUsage
var remark = require('remark')
var findAllBefore = require('unist-util-find-all-before')
var tree = remark().parse('Some _emphasis_, **importance**, and `code`.')
var paragraph = tree.children[0]
var code = paragraph.children[paragraph.children.length - 1]
console.log(findAllBefore(paragraph, code, 'text'))Yields:
[ { type: 'text', value: ', and ' },
{ type: 'text', value: ', ' },
{ type: 'text', value: 'Some ' } ]API
findAllBefore(parent, node|index[, test])
Find the first child before index (or node) in parent, that passes test
(when given).
Parameters
parent(Node) — Context nodenode(Node) — Node inparentindex(number, optional) — Position of anodeinparenttest(Function,string, orNode, optional) — Seeunist-util-is
Returns
Array.<Node> — Child nodes of parent passing test.
Related
unist-util-find-after— Find a node after another nodeunist-util-find-before— Find a node before another nodeunist-util-find-all-after— Find all nodes after another nodeunist-util-find-all-between— Find all nodes between two nodesunist-util-find— Find nodes matching a predicate
Contribute
See contributing.md in syntax-tree/unist for ways to get
started.
This organisation has a Code of Conduct. By interacting with this repository, organisation, or community you agree to abide by its terms.