post-split

Split a post (status, tweet) up into human-readable strings of a set length.

npm install post-split
16 downloads in the last month

post-split

build status

Split a post (status, tweet) up into human-readable segments that fit inside a specific length.

Usage

The following assumes this:

var ps = require('post-split');

var post = 'Hello world, this is a long post that I wish to be split into many sub-posts. It\'s long, which is useful becuse it needs to be. Longer and longer it goes. Yes.';

Extract segments from a post:

var segments = ps.segments(post, 50);

/*
segments =
[ 'Hello world, this is a long post that I wish to',
  ' be split into many sub-posts. It\'s long, which',
  ' is useful becuse it needs to be. Longer and',
  ' longer it goes. Yesh.' ]
 */

With a longer segment length:

 var segments = ps.segments(post, 70);

/*
 segments =
[ 'Hello world, this is a long post that I wish to be split into many',
  ' sub-posts. It\'s long, which is useful becuse it needs to be. Longer',
  ' and longer it goes. Yesh.' ]
  */

Install

npm install post-split

License

MIT

npm loves you