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

line-clamp

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

line-clamp - npm Package Compare versions

Comparing version 0.0.6 to 0.0.7

25

index.js

@@ -7,17 +7,2 @@ function truncateTextNode (

) {
truncateTextNodeByWord(
textNode,
rootElement,
maximumHeight,
ellipsisCharacter
)
return truncateTextNodeByCharacter(
textNode,
rootElement,
maximumHeight,
ellipsisCharacter
)
}
function truncateTextNodeByWord (textNode, rootElement, maximumHeight) {
var lastIndexOfWhitespace

@@ -28,3 +13,3 @@ var textContent = textNode.textContent

if (lastIndexOfWhitespace == -1) {
return
break
}

@@ -34,6 +19,12 @@ textNode.textContent = textContent.substring(0, lastIndexOfWhitespace)

textNode.textContent = textContent
return
break
}
textContent = textNode.textContent
}
return truncateTextNodeByCharacter(
textNode,
rootElement,
maximumHeight,
ellipsisCharacter
)
}

@@ -40,0 +31,0 @@

{
"name": "line-clamp",
"version": "0.0.6",
"version": "0.0.7",
"description": "Line clamp a DOM element in vanilla JavaScript.",

@@ -22,3 +22,3 @@ "author": "Lim Yuan Qing",

"start": "concurrently \"watchify index.js --standalone lineClamp --outfile example/bundle.js\" \"ecstatic example --port 8080\" \"opn 'http://0.0.0.0:8080/'\"",
"lint": "prettier-standard index.js test/index.js --no-semi --single-quote --write",
"lint": "prettier-standard index.js --no-semi --single-quote --write",
"weight": "uglifyjs index.js --compress --mangle --toplevel | gzip-size"

@@ -25,0 +25,0 @@ },

@@ -5,7 +5,6 @@ # line-clamp [![npm Version](http://img.shields.io/npm/v/line-clamp.svg?style=flat)](https://www.npmjs.com/package/line-clamp) [![Build Status](https://img.shields.io/travis/yuanqing/line-clamp.svg?branch=master&style=flat)](https://travis-ci.org/yuanqing/line-clamp)

- Pure JavaScript; does *not* use [`-webkit-line-clamp`](https://css-tricks.com/line-clampin/)
- Truncates in pure JavaScript; does *not* rely on [`-webkit-line-clamp`](https://css-tricks.com/line-clampin/)
- Works even if the given element contains nested DOM nodes
- Supports appending a custom string instead of an ellipsis
- Exit if we detect that content does not actually overflow the element
- 494 bytes gzipped
- Supports appending a custom string instead of an ellipsis (`…`)
- 476 bytes gzipped

@@ -84,2 +83,3 @@ ## Usage

- [FTEllipsis](https://github.com/ftlabs/ftellipsis)
- [Shave](https://github.com/dollarshaveclub/shave)

@@ -86,0 +86,0 @@ ## License

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