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

sipware

Package Overview
Dependencies
Maintainers
1
Versions
263
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sipware - npm Package Compare versions

Comparing version 0.6.28 to 0.6.29

81

lib/headers.js

@@ -295,3 +295,3 @@ const debug = require('debug') ('sipware:headers')

if(addr.display_name) {
var str = `${this.encodeDisplayName(addr.display_name)} <${address}>`
var str = `${this.encodeDisplayName(addr.display_name)} <${address}>`

@@ -303,13 +303,12 @@ return addr.group ? `${this.encodeDisplayName(addr.group)}: ${str};` : str;

},
printSingleAddrs(addrs = []) {
if(addrs) {
if(Array.isArray(addrs)) {
return addrs.filter((e, i, s) => i === s.findIndex(a => a.address === e.address)).map(a => this.printAddr(a)).join(',');
}
return this.printAddr(addrs);
}
return '';
uniqAddrs(addrs = []) {
return addrs.filter((e, i, s) => i === s.findIndex(a => a.address === e.address));
},
printUniqAddrs(addrs = []) {
if(!addrs) return '';
return !Array.isArray(addrs) ? this.printAddr(addrs) : this.uniqAddrs(addrs).map(a => this.printAddr(a)).join(',');
},
printGroups(groups = {}) {
var values = [];
var val = [];

@@ -319,58 +318,40 @@ for(var g in groups) {

if(typeof groups[g] === 'string' || Array.isArray(groups[g])) {
var addr = this.parseAddrs(groups[g]);
var addrs = this.parseAddrs(groups[g]);
} else {
var addr = groups[g];
var addrs = groups[g];
}
if(addr && addr.length) {
values.push(`${this.encodeDisplayName(g)}: ${this.printSingleAddrs(addr.map(a => ({...a, group: undefined})))};`);
if(addrs && addrs.length) {
val.push(`${this.encodeDisplayName(g)}: ${this.printUniqAddrs(addrs.map(a => ({...a, group: undefined})))};`);
}
}
}
return values.join(', ');
return val.join(', ');
},
printAddrs(addresses = []) {
var uniq = [], groups = {}, addrs = this.parseAddrs(addresses);
printAddrs(addresses = [], opts = {}) {
var val = [], addrs = this.parseAddrs(addresses);
var uniq = {};
if(addrs && addrs.length) {
var values = [];
if(!addrs?.length) return '';
addrs.forEach(a => {
if(!a) return;
for(var i = 0; i < addrs.length; i++) {
if(!addrs[i]) continue;
if(a.group) {
groups[a.group] = groups[a.group] || [];
var {group} = addrs[i];
if(a.address) {
groups[a.group].push(a);
}
} else if(typeof a === 'object') {
values.push(this.printAddr(a));
} else if(a.address) {
a.address = this.normalizeAddr(a.address);
if(group) {
var groups = [{...addrs[i], group: undefined}];
if(!a.display_name) {
values.push(a.address);
} else if (a.display_name) {
values.push(`${this.encodeDisplayName(a.display_name)} <${a.address}>`);
}
for(var j = i + 1; j < addrs.length && group == addrs[j]?.group; i = j, j++) {
groups.push({...addrs[j], group: undefined});
}
if(a.address) {
if(!uniq.find(i => i.address === a.address)) {
uniq.push(a);
}
}
}
})
for(var g in groups) {
if(groups[g] && groups[g].length) {
values.push(`${this.encodeDisplayName(g)}: ${this.printSingleAddrs(groups[g].map(a => ({...a, group: undefined})))};`);
} else {
values.push(this.encodeDisplayName(g) + ':;');
}
val.push(`${this.encodeDisplayName(group)}:${this.printUniqAddrs(groups)};`);
} else if(typeof addrs[i] === 'object') {
if(!uniq[addrs[i].address]) val.push(this.printAddr(addrs[i]));
if(opts.uniq) uniq[addrs[i].address] = true;
}
return values.join(', ');
}
return '';
return val.join(',');
},
}

@@ -67,3 +67,3 @@ {

"optionalDependencies": {},
"version": "0.6.28",
"version": "0.6.29",
"directories": {

@@ -70,0 +70,0 @@ "lib": "lib"

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