Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

retext-visit

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

retext-visit

Retext node visitor

  • 0.0.5
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

retext-visit Build Status Coverage Status

browser support

See Browser Support for more information (a.k.a. don’t worry about those grey icons above).


retext node visitor.

Installation

NPM:

$ npm install retext-visit

Component.js:

$ component install wooorm/retext-visit

Usage

var Retext = require('retext'),
    visit = require('retext-visit');

var root = new Retext()
    .use(visit)
    .parse('A simple english sentence.');

API

Node#visit(callback)

root.head.head.visit(function (node) {
    console.log(node.toString());
});
// 'A'
// ' '
// 'simple'
// ' '
// 'english'
// ' '
// 'sentence'
// '.'

Visit every node inside the operated on node.

  • callback (function): The function to call with each node.

When callback return false, stops iterating.

Node#visitType(type, callback)

root.visitType(root.WORD_NODE, function (wordNode) {
    console.log(wordNode.toString());
});
// 'A'
// 'simple'
// 'english'
// 'sentence'

Visit every node of type type inside the operated on node.

  • type: A type of a node (e.g., PARAGRAPH_NODE, WORD_NODE, or WHITE_SPACE_NODE);
  • callback (function): The function to call with each node.

When callback return false, stops iterating.

Browser Support

Pretty much every browser (available through browserstack) runs all retext-visit unit tests.

License

MIT

Keywords

FAQs

Package last updated on 19 Jun 2014

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc