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

excerpts

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

excerpts

Excerpting text of given words or characters from HTML.

  • 0.0.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

excerpts Build Status

Excerpting words or characters of text from an HTML snippet.

Installation

$ npm install excerpts

Usage

Given HTML snippet:

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

Words

Excerpting words with the words option:

var excerpts = require('excerpts');
var text = excerpts(html, { words: 3 });
//=> Lorem ipsum dolor...

Characters

Excerpting characters with the characters option:

var excerpts = require('excerpts');
var text = excerpts(html, { characters: 10 });
//=> Lorem ipsum dol...

The words option takes precedence over the characters option. By default, 50 words will be extracted when options are missing.

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 has been extracted.

Tests

$ npm install
$ npm test

License

MIT

Keywords

FAQs

Package last updated on 14 Dec 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