Comparing version 0.0.2 to 0.2.0
{ | ||
"name": "sdp", | ||
"version": "0.0.2", | ||
"version": "0.2.0", | ||
"description": "A parser/serializer for SDP to JSON. Useful for converting SDP to other formats like Jingle for WebRTC signalling", | ||
@@ -19,3 +19,3 @@ "main": "sdp.js", | ||
"dependencies": { | ||
"lodash": "1.3.1" | ||
"underscore": "1.5.2" | ||
}, | ||
@@ -22,0 +22,0 @@ "devDependencies": { |
91
sdp.js
@@ -1,2 +0,2 @@ | ||
var _ = require('lodash'); | ||
var _ = require('underscore'); | ||
var each = _.each; | ||
@@ -6,3 +6,3 @@ var filter = _.filter; | ||
var Session = exports.Session = function () { | ||
var Session = exports.Session = function (opts) { | ||
var self = this; | ||
@@ -17,2 +17,4 @@ | ||
self.attributes = []; | ||
_.extend(self, opts || {}); | ||
}; | ||
@@ -86,3 +88,3 @@ Session.prototype = { | ||
}); | ||
return results; | ||
@@ -93,3 +95,3 @@ } | ||
var Media = exports.Media = function () { | ||
var Media = exports.Media = function (opts) { | ||
var self = this; | ||
@@ -105,2 +107,4 @@ | ||
self.attributes = []; | ||
_.extend(self, opts || {}); | ||
}; | ||
@@ -141,8 +145,8 @@ Media.prototype = { | ||
}, | ||
get payloads() { | ||
var results = {}; | ||
get payloadTypes() { | ||
var payloads = {}; | ||
var vals = ''; | ||
each(this.formats, function (fmtID) { | ||
results[fmtID] = { | ||
payloads[fmtID] = { | ||
feedback: [], | ||
@@ -160,7 +164,7 @@ parameters: [] | ||
if (results[codec]) { | ||
results[codec].id = codec; | ||
results[codec].name = vals[0]; | ||
results[codec].clockSpeed = vals[1] || undefined; | ||
results[codec].channels = vals[2] || 1; | ||
if (payloads[codec]) { | ||
payloads[codec].id = codec; | ||
payloads[codec].name = vals[0]; | ||
payloads[codec].clockSpeed = vals[1] || undefined; | ||
payloads[codec].channels = vals[2] || 1; | ||
} | ||
@@ -176,3 +180,3 @@ } | ||
if (results[codec]) { | ||
if (payloads[codec]) { | ||
each(vals, function (val) { | ||
@@ -184,3 +188,3 @@ var parsed = val.split('='); | ||
if (key) { | ||
results[codec].parameters.push({key: key, value: value}); | ||
payloads[codec].parameters.push({key: key, value: value}); | ||
} | ||
@@ -201,4 +205,4 @@ }); | ||
if (codec !== '*' && results[codec]) { | ||
results[codec].feedback.push(fb); | ||
if (codec !== '*' && payloads[codec]) { | ||
payloads[codec].feedback.push(fb); | ||
} | ||
@@ -208,5 +212,10 @@ return; | ||
}); | ||
var results = []; | ||
each(payloads, function (payload) { | ||
results.push(payload); | ||
}); | ||
return results; | ||
}, | ||
set payloads(val) { | ||
set payloadTypes(val) { | ||
var self = this; | ||
@@ -510,45 +519,19 @@ each(val, function (payload) { | ||
}, | ||
get sendonly() { | ||
return (filter(this.attributes, function (attr) { | ||
return attr.key === 'sendonly'; | ||
})).length > 0; | ||
}, | ||
set sendonly(val) { | ||
this.attributes.push({ | ||
key: 'sendonly', | ||
value: true | ||
get streamMode() { | ||
var result = ''; | ||
each(this.attributes, function (attr) { | ||
if (attr.key === 'sendrecv' || attr.key === 'recvonly' || attr.key === 'sendonly' || attr.key === 'inactive') { | ||
result = attr.key; | ||
} | ||
}); | ||
return result; | ||
}, | ||
get recvonly() { | ||
return (filter(this.attributes, function (attr) { | ||
return attr.key === 'recvonly'; | ||
})).length > 0; | ||
}, | ||
set recvonly(val) { | ||
this.attributes.push({ | ||
key: 'recvonly', | ||
value: true | ||
set streamMode(val) { | ||
this.attributes = _.filter(this.attributes, function (attr) { | ||
return attr.key !== 'inactive' && attr.key !== 'sendonly' && attr.key !== 'recvonly' && attr.key !== 'sendrecv'; | ||
}); | ||
}, | ||
get sendrecv() { | ||
return (filter(this.attributes, function (attr) { | ||
return attr.key === 'sendrecv'; | ||
})).length > 0; | ||
}, | ||
set sendrecv(val) { | ||
this.attributes.push({ | ||
key: 'sendrecv', | ||
key: val, | ||
value: true | ||
}); | ||
}, | ||
get inactive() { | ||
return (filter(this.attributes, function (attr) { | ||
return attr.key === 'inactive'; | ||
})).length > 0; | ||
}, | ||
set inactive(val) { | ||
this.attributes.push({ | ||
key: 'inactive', | ||
value: true | ||
}); | ||
} | ||
@@ -555,0 +538,0 @@ }; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
1
229170
6331
+ Addedunderscore@1.5.2
+ Addedunderscore@1.5.2(transitive)
- Removedlodash@1.3.1
- Removedlodash@1.3.1(transitive)