Skip to content

Commit

Permalink
Fix: numeric matcher used by the XML parser (Dash-Industry-Forum#2)
Browse files Browse the repository at this point in the history
Signed-off-by: Gontran Baerts <gbaerts@molotov.tv>
  • Loading branch information
Gontran-Molotov committed Oct 17, 2017
1 parent f23f970 commit ad51456
Showing 1 changed file with 3 additions and 23 deletions.
26 changes: 3 additions & 23 deletions src/dash/parser/matchers/NumericMatcher.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,35 +33,15 @@
*/
import BaseMatcher from './BaseMatcher';

// const numericRegex = /^[-+]?[0-9]+[.]?[0-9]*([eE][-+]?[0-9]+)?$/;
const numericRegex = /^[-+]?[0-9]+[.]?[0-9]*(?:[eE][-+]?[0-9]+)?$/;

class NumericMatcher extends BaseMatcher {
constructor() {

const attributeList = [
'id',
'd', 'r', 't',
'audioSamplingRate',
'frameRate',
'bandwidth', 'maxBandwidth', 'minBandwidth',
'group',
'startWithSAP', 'timescale',
'value',
'width', 'height', 'maxWidth', 'maxHeight'
];

let value;

super(
attr => {
if (attributeList.includes(attr.nodeName)) {
value = parseFloat(attr.value);
return !isNaN(value);
}
return false;
return numericRegex.test(attr.value);
},
// attr => numericRegex.test(attr.value),
() => value
str => parseFloat(str)
);
}
}
Expand Down

0 comments on commit ad51456

Please sign in to comment.