Socket
Socket
Sign inDemoInstall

string-template

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

string-template - npm Package Compare versions

Comparing version 0.2.1 to 1.0.0

coverage/base.css

13

compile.js

@@ -27,3 +27,3 @@ var template = require("./index")

function compile(string, inline) {
var replacements = string.match(nargs)
var replacements = string.match(nargs) || []
var interleave = string.split(nargs)

@@ -33,4 +33,4 @@ var replace = []

for (var i = 0; i < interleave.length; i++) {
var current = interleave[i];
var replacement = replacements[i];
var current = interleave[i]
var replacement = replacements[i]
var escapeLeft = current.charAt(current.length - 1)

@@ -46,3 +46,3 @@ var escapeRight = (interleave[i + 1] || "").charAt(0)

} else {
replace.push(current);
replace.push(current)
if (replacement) {

@@ -122,5 +122,4 @@ replace.push({ name: replacement })

function escape(string) {
string = '' + string;
return string.replace(whitespaceRegex, escapedWhitespace);
string = '' + string
return string.replace(whitespaceRegex, escapedWhitespace)
}

@@ -127,0 +126,0 @@

@@ -1,3 +0,2 @@

var nargs = /\{([0-9a-zA-Z]+)\}/g
var slice = Array.prototype.slice
var nargs = /\{([0-9a-zA-Z_]+)\}/g

@@ -12,3 +11,6 @@ module.exports = template

} else {
args = slice.call(arguments, 1)
args = new Array(arguments.length - 1)
for (var i = 1; i < arguments.length; ++i) {
args[i - 1] = arguments[i]
}
}

@@ -15,0 +17,0 @@

{
"name": "string-template",
"version": "0.2.1",
"version": "1.0.0",
"description": "A simple string template function based on named or indexed arguments",

@@ -27,10 +27,7 @@ "keywords": [

"devDependencies": {
"istanbul": "^0.4.1",
"opn": "^3.0.3",
"tape": "~1.1.1"
},
"licenses": [
{
"type": "MIT",
"url": "http://github.com/Matt-Esch/string-template/raw/master/LICENSE"
}
],
"license": "MIT",
"scripts": {

@@ -40,3 +37,3 @@ "test": "node ./test/index.js",

"cover": "istanbul cover --report none --print detail ./test/index.js",
"view-cover": "istanbul report html && google-chrome ./coverage/index.html"
"view-cover": "istanbul report html && opn --no-wait ./coverage/index.html"
},

@@ -43,0 +40,0 @@ "testling": {

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