Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
private assignModMetadata(metadata: MetaData): MetaData {
if (metadata === undefined || metadata === null) {
metadata = new MetaData();
metadata.HasMod = true;
} else {
metadata.HasMod = true;
}
return metadata
}
durationEr.forEach(er => {
let pos = er.start + er.length;
if (pos < source.length) {
let suffix = source.substr(pos, 1);
let beforeMatch = RegExpUtility.getMatches(ChineseDateTimeExtractor.beforeRegex, suffix).pop();
let afterMatch = RegExpUtility.getMatches(ChineseDateTimeExtractor.afterRegex, suffix).pop();
if (beforeMatch && suffix.startsWith(beforeMatch.value) || afterMatch && suffix.startsWith(afterMatch.value)) {
let metadata = new MetaData();
metadata.IsDurationWithAgoAndLater = true;
ret.push(new Token(er.start, pos + 1, metadata));
}
}
});
return ret;
durationEr.forEach(er => {
if (!RegExpUtility.isMatch(ChineseDateExtractor.dateTimePeriodUnitRegex, er.text)) {
let pos = er.start + er.length;
if (pos < source.length) {
let suffix = source.substr(pos, 1);
let beforeMatch = RegExpUtility.getMatches(ChineseDateExtractor.beforeRegex, suffix).pop();
let afterMatch = RegExpUtility.getMatches(ChineseDateExtractor.afterRegex, suffix).pop();
if (beforeMatch && suffix.startsWith(beforeMatch.value) || afterMatch && suffix.startsWith(afterMatch.value)) {
let metadata = new MetaData();
metadata.IsDurationWithAgoAndLater = true;
ret.push(new Token(er.start, pos + 1, metadata));
}
}
}
});
return ret;