mirror of
https://github.com/Smaug123/KaTeX
synced 2025-10-07 04:08:43 +00:00
lexer: Remove match-at
dependency, use RegExp (#1447)
* lexer: Remove `match-at` dependency, use RegExp * chore(package): update flow-bin to version 0.75.0 * Fix flow error * Remove unused flow libs * Minor fix * Throw an error when `RegExp.exec` jumps
This commit is contained in:
@@ -23,9 +23,17 @@ const typeFirstCompare = (a, b) => {
|
||||
}
|
||||
};
|
||||
|
||||
const regExpReplacer = (key, value) => {
|
||||
return value instanceof RegExp ? {lastIndex: value.lastIndex} : value;
|
||||
};
|
||||
|
||||
const serializer = {
|
||||
print(val) {
|
||||
return stringify(val, {cmp: typeFirstCompare, space: ' '});
|
||||
return stringify(val, {
|
||||
cmp: typeFirstCompare,
|
||||
space: ' ',
|
||||
replacer: regExpReplacer,
|
||||
});
|
||||
},
|
||||
test(val) {
|
||||
// Leave strings (e.g. XML) to other serializers
|
||||
|
Reference in New Issue
Block a user