post-split
v0.0.5
Published
Split a post (status, tweet) up into human-readable strings of a set length.
Downloads
4
Readme
post-split
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