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.9.6 to 1.9.7

test/TestCache.js

2

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

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

@@ -7,8 +7,19 @@ /**

export class Template {
constructor(template) {
this.template = template
constructor(templateOrContent) {
if(templateOrContent instanceof HTMLElement) {
this.content = ""
for (const childNode of templateOrContent.content.childNodes) {
if(childNode.nodeType === Node.TEXT_NODE) {
this.content += childNode.wholeText
} else if(childNode.nodeType === Node.ELEMENT_NODE) {
this.content += childNode.outerHTML
}
}
} else if (typeof templateOrContent === 'string' || templateOrContent instanceof String) {
this.content = templateOrContent
}
}
render(replacements) {
return this.template.replace(/\${(.*?)}/g, (toReplace, key) => {
return this.content.replace(/\${(.*?)}/g, (toReplace, key) => {
if(replacements[key] === undefined) {

@@ -15,0 +26,0 @@ return toReplace

@@ -18,13 +18,2 @@ /**

static replaceAll(str, replacementsObj, ignoreCase = false) {
console.warn("replaceAll is deprecated and will be removed in future versions")
let retStr = str
const flags = ignoreCase ? "gi" : "g"
for (let needle in replacementsObj) {
// noinspection JSUnfilteredForInLoop
retStr = retStr.replace(new RegExp(needle, flags), replacementsObj[needle])
}
return retStr
}
static crop(str, maxLength) {

@@ -31,0 +20,0 @@ if (str.length > maxLength) {

Sorry, the diff of this file is not supported yet

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