Socket
Socket
Sign inDemoInstall

snapdragon-capture

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

snapdragon-capture

Snapdragon plugin that adds a capture method to the parser instance.


Version published
Weekly downloads
564
decreased by-7.69%
Maintainers
1
Weekly downloads
 
Created
Source

snapdragon-capture NPM version NPM monthly downloads NPM total downloads Linux Build Status

Snapdragon plugin that adds a capture method to the parser instance.

Install

Install with npm:

$ npm install --save snapdragon-capture

Usage

Requires snapdragon v0.9.0 or higher.

var capture = require('snapdragon-capture');
var Snapdragon = require('snapdragon');
var snapdragon = new Snapdragon();
snapdragon.use(capture());

API

Example

var Snapdragon = require('snapdragon');
var capture = require('snapdragon-capture');
var parser = new Snapdragon.Parser();
parser.use(capture());

capture

Create a node of the given type using the specified regex or function.

Params

  • type {String}
  • regex {RegExp|Function}: Pass the regex to use for capturing. Pass a function if you need access to the parser instance.
  • returns {Object}: Returns the parser instance for chaining

Example

parser
  .capture('slash', /^\//)
  .capture('comma', /^,/)
  .capture('foo', function() {
    var pos = this.position();
    var match = this.match(/^\./);
    if (match) {
      return pos(this.node(match[0]));
    }
  });

About

Contributing

Pull requests and stars are always welcome. For bugs and feature requests, please create an issue.

Please read the contributing guide for advice on opening issues, pull requests, and coding standards.

Building docs

(This project's readme.md is generated by verb, please don't edit the readme directly. Any changes to the readme must be made in the .verb.md readme template.)

To generate the readme, run the following command:

$ npm install -g verbose/verb#dev verb-generate-readme && verb

Running tests

Running and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command:

$ npm install && npm test

Author

Jon Schlinkert

License

Copyright © 2017, Jon Schlinkert. MIT


This file was generated by verb-generate-readme, v0.4.2, on February 08, 2017.

Keywords

FAQs

Package last updated on 09 Feb 2017

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