New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

cm-web-modules

Package Overview
Dependencies
Maintainers
1
Versions
146
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cm-web-modules - npm Package Compare versions

Comparing version 1.18.10 to 1.18.11

2

package.json
{
"name": "cm-web-modules",
"version": "1.18.10",
"version": "1.18.11",
"description": "Collection of clean and small ES6 modules for the web",

@@ -5,0 +5,0 @@ "main": "src/LibraryManager.js",

@@ -25,2 +25,19 @@ /**

static wrap(str, maxLength) {
const words = str.split(" ")
let lines = []
let line = ""
for (let i = 0; i < words.length; i++) {
const word = words[i]
if (line.length + word.length < maxLength) {
line += word + " "
} else {
lines.push(line.trim())
line = word + " "
}
}
lines.push(line.trim())
return lines.join("\n")
}
static stripHtml(html) {

@@ -27,0 +44,0 @@ let tmp = document.createElement("div")

@@ -11,7 +11,7 @@ /**

it("should strip HTML", () => {
const htmlText = "<b>bold</b> <a href='#'>link</a> text";
const htmlText = "<b>bold</b> <a href='#'>link</a> text"
assert.equal(TextUtils.stripHtml(htmlText), "bold link text")
})
it("should crop a text", () => {
const longText = "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.";
const longText = "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur."
assert.equal(TextUtils.crop(longText, 10), "Lorem ipsu…")

@@ -34,2 +34,10 @@ })

})
// write a test for TextUtils.wrap()
it("should wrap", () => {
const raw = "Das ist ein langer Text mit vielen Wörtern."
assert.equal(TextUtils.wrap(raw, 12), `Das ist ein
langer Text
mit vielen
Wörtern.`)
})
})
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