summaryrefslogtreecommitdiff
path: root/includes/external/matrix/node_modules/sdp-transform/checker.js
diff options
context:
space:
mode:
authorRaindropsSys <contact@minteck.org>2023-04-24 14:03:36 +0200
committerRaindropsSys <contact@minteck.org>2023-04-24 14:03:36 +0200
commit633c92eae865e957121e08de634aeee11a8b3992 (patch)
tree09d881bee1dae0b6eee49db1dfaf0f500240606c /includes/external/matrix/node_modules/sdp-transform/checker.js
parentc4657e4509733699c0f26a3c900bab47e915d5a0 (diff)
downloadpluralconnect-633c92eae865e957121e08de634aeee11a8b3992.tar.gz
pluralconnect-633c92eae865e957121e08de634aeee11a8b3992.tar.bz2
pluralconnect-633c92eae865e957121e08de634aeee11a8b3992.zip
Updated 18 files, added 1692 files and deleted includes/system/compare.inc (automated)
Diffstat (limited to 'includes/external/matrix/node_modules/sdp-transform/checker.js')
-rwxr-xr-xincludes/external/matrix/node_modules/sdp-transform/checker.js47
1 files changed, 47 insertions, 0 deletions
diff --git a/includes/external/matrix/node_modules/sdp-transform/checker.js b/includes/external/matrix/node_modules/sdp-transform/checker.js
new file mode 100755
index 0000000..cf88a90
--- /dev/null
+++ b/includes/external/matrix/node_modules/sdp-transform/checker.js
@@ -0,0 +1,47 @@
+#!/usr/bin/env node
+
+var transform = require('./')
+ , file = require('path').join(process.cwd(), process.argv[2])
+ , sdp = require('fs').readFileSync(file).toString()
+ , parsed = transform.parse(sdp)
+ , written = transform.write(parsed)
+ , writtenLines = written.split('\r\n')
+ , origLines = sdp.split('\r\n')
+ , numMissing = 0
+ , numNew = 0
+ ;
+
+var parseFails = 0;
+parsed.media.forEach(function (media) {
+ (media.invalid || []).forEach(function (inv) {
+ console.warn('unrecognized a=' + inv.value + ' belonging to m=' + media.type);
+ parseFails += 1;
+ });
+});
+var parseStr = parseFails + ' unrecognized line(s) copied blindly';
+
+origLines.forEach(function (line, i) {
+ if (writtenLines.indexOf(line) < 0) {
+ console.error('l' + i + ' lost (' + line + ')');
+ numMissing += 1;
+ }
+});
+
+writtenLines.forEach(function (line, i) {
+ if (origLines.indexOf(line) < 0) {
+ console.error('l' + i + ' new (' + line + ')');
+ numNew += 1;
+ }
+});
+
+var failed = (numMissing > 0 || numNew > 0);
+if (failed) {
+ console.log('\n' + file + ' changes during transform:');
+ console.log(numMissing + ' missing line(s), ' + numNew + ' new line(s)%s',
+ parseFails > 0 ? ', ' + parseStr : ''
+ );
+}
+else {
+ console.log(file + ' verified%s', parseFails > 0 ? ', but had ' + parseStr : '');
+}
+process.exit(failed ? 1 : 0);