Socket
Socket
Sign inDemoInstall

excerpts

Package Overview
Dependencies
9
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    excerpts

Excerpting text of given words or characters from HTML.


Version published
Maintainers
1
Install size
1.38 MB
Created

Readme

Source

excerpts Build Status

Excerpting text of given words or characters from HTML.

Installation

$ npm install excerpts

Usage

Given HTML:

<p>Lorem <i>ipsum</i> dolor <em>sit</em> amet.</p>

Words

Excerpting words with words option:

var excerpts = require('excerpts');

var text = excerpts(html, { words: 3 });

//=> Lorem ipsum dolor...

Characters

Excerpting characters with characters option:

var excerpts = require('excerpts');

var text = excerpts(html, { characters: 10 });

//=> Lorem ipsum dol...

The words option takes precedence over the characters option. With missing option, 50 words would be extracted by default.

Appendix

The appendix can be customized with the append option:

var excerpts = require('excerpts');

var text = excerpts(html, { words: 3, append: " >>" });

//=> Lorem ipsum dolor >>

The appendix won't appear when full text are extracted.

Tests

$ npm install
$ npm test

License

MIT

Keywords

FAQs

Last updated on 07 Feb 2016

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc