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

@brook/strbuf

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@brook/strbuf - npm Package Compare versions

Comparing version 1.0.1 to 1.0.2

test/index.test.js

76

index.js

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

'use strict';
'use strict'
/*!

@@ -8,3 +8,2 @@ * strbuf

/**

@@ -15,10 +14,10 @@ * @class String concat

*/
function strbuf() {
var args = arguments, buf;
if(this instanceof strbuf) {
this.__data = [];
this.push.apply(this, args);
} else {// static invoke
buf = new strbuf();
return buf.push.apply(buf, args).toString();
function strbuf () {
var args = arguments, buf
if (this instanceof strbuf) {
this.__data = []
this.push.apply(this, args)
} else { // static invoke
buf = new strbuf()
return buf.push.apply(buf, args).toString()
}

@@ -31,31 +30,34 @@ }

*/
push: function(s, /*{Object/String...} */o, _undef) {
var args = arguments, str;
if(args.length < 2) {
str = s === undefined ? '' : s;
} else if(typeof o === 'object') {
str = s.replace(/\$\{([\w.]+)\}/g, function($, $1) {
var parts = $1.split('.'), i = 0, len = parts.length, res = o;
while(i < len) {
push: function (s, /* {Object/String...} */o, _undef) {
var args = arguments, str
if (args.length < 2) {
str = s === undefined ? '' : s
} else if (typeof o === 'object') {
str = s.replace(/\$\{([\w.]+)\}/g, function ($, $1) {
if ($1 in o) {
return o[$1]
}
var parts = $1.split('.'), i = 0, len = parts.length, res = o
while (i < len) {
try {
res = res[parts[i++]];
} catch(ex){
res = $;
res = res[parts[i++]]
} catch (ex) {
res = $
}
}
return res === undefined ? _undef : res;
});
return res === undefined ? _undef : res
})
} else {
str = s.replace(/\{(\d+)\}/g, function($, $1) {
return args[+$1 + 1];
});
str = s.replace(/\{(\d+)\}/g, function ($, $1) {
return args[+$1 + 1]
})
}
this.__data.push(str);
return this;// chainability
this.__data.push(str)
return this// chainability
},
pushArray: function(s, arr, _undef) {
for(var i = 0, item; i < arr.length; i++) {
item = arr[i];
pushArray: function (s, arr, _undef) {
for (var i = 0, item; i < arr.length; i++) {
item = arr[i]
// item.__index = i;
this.push(s, item, _undef);
this.push(s, item, _undef)
}

@@ -67,8 +69,8 @@ },

*/
toString: function(delimiter) {
return this.__data.join(delimiter === undefined ? '' : delimiter);
toString: function (delimiter) {
return this.__data.join(delimiter === undefined ? '' : delimiter)
}
};
if(typeof module !== 'undefined') {
module.exports = strbuf;
}
if (typeof module !== 'undefined') {
module.exports = strbuf
}
{
"name": "@brook/strbuf",
"version": "1.0.1",
"version": "1.0.2",
"description": "concat javascript string in es6 way",

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

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