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 node;node(Node) — Node inparent;index(number, optional) — Position of anodeinparent;test(Function,string, orNode, optional) — Seeunist-util-is.
Returns
Array.<Node> — Child nodes of parent passing test.