Skip to content

Commit

Permalink
small fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
brankosekulic committed Aug 4, 2014
1 parent a616cec commit e1e8eea
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
1 change: 1 addition & 0 deletions README.md
@@ -1,4 +1,5 @@
#trim-html#
Cutting a HTML String without breaking HTML Tags

##Installation##

Expand Down
7 changes: 4 additions & 3 deletions index.js
Expand Up @@ -8,8 +8,9 @@ function trimHtml(html, options){

options = options || {};

limit = options.limit || 100;
preserveTags = (typeof options.preserveTags !== 'undefined') ? options.preserveTags : true;
var limit = options.limit || 100,
preserveTags = (typeof options.preserveTags !== 'undefined') ? options.preserveTags : true,
sufix = options.sufix || '...';

var arr = html.replace(/</g, "\n<")
.replace(/>/g, ">\n")
Expand Down Expand Up @@ -53,7 +54,7 @@ function trimHtml(html, options){
}
}

row = row.substring(0, cut) + '...';
row = row.substring(0, cut) + sufix;
sum = limit;
more = true;
}else{
Expand Down
2 changes: 1 addition & 1 deletion package.json
@@ -1,6 +1,6 @@
{
"name": "trim-html",
"version": "0.1.0",
"version": "0.1.1",
"homepage": "https://github.com/brankosekulic/trimHtml",
"keywords": [
"trim",
Expand Down

0 comments on commit e1e8eea

Please sign in to comment.