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

truncatise

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

truncatise - npm Package Compare versions

Comparing version 0.0.5 to 0.0.6

14

index.js

@@ -96,3 +96,4 @@ (function(exportTo) {

currentState = NOT_TAG;
if(currentTag.toLowerCase() === "/p"){
currentTag = currentTag.toLowerCase();
if(currentTag === "/p"){
paragraphCounter++;

@@ -104,6 +105,9 @@ if(options.StripHTML){

if(currentTag.indexOf("/") === -1){
tagStack.push(currentTag);
}else if(selfClosingTags.indexOf(currentTag) === -1){
tagStack.pop();
// Ignore self-closing tags.
if ((selfClosingTags.indexOf(currentTag) === -1) && (selfClosingTags.indexOf(currentTag + '/') === -1)) {
if(currentTag.indexOf("/") >= 0){
tagStack.pop();
} else {
tagStack.push(currentTag);
}
}

@@ -110,0 +114,0 @@ }

{
"name": "truncatise",
"version": "0.0.5",
"version": "0.0.6",
"description": "Truncate HTML based on characters, words or paragraphs. Has the ability to strip tags.",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -170,2 +170,7 @@ var truncatise = require("./"),

});
it("should not append self-closing br tags to the end of the string",function(){
truncatise("<p>This<br>handles<br></p>",{TruncateLength: 2, TruncateBy : "words", StripHTML : false, Suffix : ''})
.should.equal("<p>This<br>handles<br></p>");
});
});

@@ -172,0 +177,0 @@

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