mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-01-19 14:13:34 +01:00
Changeset: Remove unused lastIndex()
method from op iterator
This commit is contained in:
parent
0fd2a46783
commit
dd8ec4e291
2 changed files with 2 additions and 10 deletions
|
@ -39,7 +39,8 @@
|
|||
* `readonly`: Deprecated; use the new `readOnly` property instead.
|
||||
* `rev`: Deprecated.
|
||||
* Changes to the `src/static/js/Changeset.js` library:
|
||||
* `opIterator()`: The unused start index parameter has been removed.
|
||||
* `opIterator()`: The unused start index parameter has been removed, as has
|
||||
the unused `lastIndex()` method on the returned object.
|
||||
|
||||
### Notable enhancements
|
||||
|
||||
|
|
|
@ -134,7 +134,6 @@ exports.newLen = (cs) => exports.unpack(cs).newLen;
|
|||
*
|
||||
* @typedef {object} OpIter
|
||||
* @property {Function} hasNext -
|
||||
* @property {Function} lastIndex -
|
||||
* @property {Function} next -
|
||||
*/
|
||||
|
||||
|
@ -146,14 +145,9 @@ exports.newLen = (cs) => exports.unpack(cs).newLen;
|
|||
*/
|
||||
exports.opIterator = (opsStr) => {
|
||||
const regex = /((?:\*[0-9a-z]+)*)(?:\|([0-9a-z]+))?([-+=])([0-9a-z]+)|\?|/g;
|
||||
let curIndex = 0;
|
||||
let prevIndex = curIndex;
|
||||
|
||||
const nextRegexMatch = () => {
|
||||
prevIndex = curIndex;
|
||||
regex.lastIndex = curIndex;
|
||||
const result = regex.exec(opsStr);
|
||||
curIndex = regex.lastIndex;
|
||||
if (result[0] === '?') {
|
||||
exports.error('Hit error opcode in op stream');
|
||||
}
|
||||
|
@ -178,12 +172,9 @@ exports.opIterator = (opsStr) => {
|
|||
|
||||
const hasNext = () => !!(regexResult[0]);
|
||||
|
||||
const lastIndex = () => prevIndex;
|
||||
|
||||
return {
|
||||
next,
|
||||
hasNext,
|
||||
lastIndex,
|
||||
};
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue