From 0fd2a4678316fdc06d5d1a52320d92847a7d275a Mon Sep 17 00:00:00 2001 From: Richard Hansen Date: Wed, 20 Oct 2021 19:15:30 -0400 Subject: [PATCH] Changeset: Remove unused start index parameter for `opIterator()` --- CHANGELOG.md | 2 ++ src/static/js/Changeset.js | 8 +++----- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b7621954..da1fb206 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -38,6 +38,8 @@ * `author`: Deprecated; use the new `authorId` property instead. * `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. ### Notable enhancements diff --git a/src/static/js/Changeset.js b/src/static/js/Changeset.js index e483afba..796ae913 100644 --- a/src/static/js/Changeset.js +++ b/src/static/js/Changeset.js @@ -142,13 +142,11 @@ exports.newLen = (cs) => exports.unpack(cs).newLen; * Creates an iterator which decodes string changeset operations. * * @param {string} opsStr - String encoding of the change operations to perform. - * @param {number} [optStartIndex=0] - From where in the string should the iterator start. * @returns {OpIter} Operator iterator object. */ -exports.opIterator = (opsStr, optStartIndex) => { +exports.opIterator = (opsStr) => { const regex = /((?:\*[0-9a-z]+)*)(?:\|([0-9a-z]+))?([-+=])([0-9a-z]+)|\?|/g; - const startIndex = (optStartIndex || 0); - let curIndex = startIndex; + let curIndex = 0; let prevIndex = curIndex; const nextRegexMatch = () => { @@ -2037,7 +2035,7 @@ exports.makeAttribsString = (opcode, attribs, pool) => { * Like "substring" but on a single-line attribution string. */ exports.subattribution = (astr, start, optEnd) => { - const iter = exports.opIterator(astr, 0); + const iter = exports.opIterator(astr); const assem = exports.smartOpAssembler(); const attOp = exports.newOp(); const csOp = exports.newOp();