Skip to content

Commit 363cd22

Browse files
committed
Changeset: Make the Builder attribs and pool args optional
1 parent 235140d commit 363cd22

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

src/static/js/Changeset.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1949,13 +1949,13 @@ class Builder {
19491949
* @param {number} N - Number of characters to keep.
19501950
* @param {number} L - Number of newlines among the `N` characters. If positive, the last
19511951
* character must be a newline.
1952-
* @param {(string|Attribute[])} attribs - Either [[key1,value1],[key2,value2],...] or '*0*1...'
1952+
* @param {(string|Attribute[])} [attribs] - Either [[key1,value1],[key2,value2],...] or '*0*1...'
19531953
* (no pool needed in latter case).
1954-
* @param {?AttributePool} pool - Attribute pool, only required if `attribs` is a list of
1954+
* @param {?AttributePool} [pool] - Attribute pool, only required if `attribs` is a list of
19551955
* attribute key, value pairs.
19561956
* @returns {Builder} this
19571957
*/
1958-
keep(N, L, attribs, pool) {
1958+
keep(N, L, attribs = '', pool = null) {
19591959
const o = new Op('=');
19601960
o.attribs = typeof attribs === 'string'
19611961
? attribs : new AttributeMap(pool).update(attribs || []).toString();
@@ -1967,26 +1967,26 @@ class Builder {
19671967

19681968
/**
19691969
* @param {string} text - Text to keep.
1970-
* @param {(string|Attribute[])} attribs - Either [[key1,value1],[key2,value2],...] or '*0*1...'
1970+
* @param {(string|Attribute[])} [attribs] - Either [[key1,value1],[key2,value2],...] or '*0*1...'
19711971
* (no pool needed in latter case).
1972-
* @param {?AttributePool} pool - Attribute pool, only required if `attribs` is a list of
1972+
* @param {?AttributePool} [pool] - Attribute pool, only required if `attribs` is a list of
19731973
* attribute key, value pairs.
19741974
* @returns {Builder} this
19751975
*/
1976-
keepText(text, attribs, pool) {
1976+
keepText(text, attribs = '', pool = null) {
19771977
this._ops.push(...opsFromText('=', text, attribs, pool));
19781978
return this;
19791979
}
19801980

19811981
/**
19821982
* @param {string} text - Text to insert.
1983-
* @param {(string|Attribute[])} attribs - Either [[key1,value1],[key2,value2],...] or '*0*1...'
1983+
* @param {(string|Attribute[])} [attribs] - Either [[key1,value1],[key2,value2],...] or '*0*1...'
19841984
* (no pool needed in latter case).
1985-
* @param {?AttributePool} pool - Attribute pool, only required if `attribs` is a list of
1985+
* @param {?AttributePool} [pool] - Attribute pool, only required if `attribs` is a list of
19861986
* attribute key, value pairs.
19871987
* @returns {Builder} this
19881988
*/
1989-
insert(text, attribs, pool) {
1989+
insert(text, attribs = '', pool = null) {
19901990
this._ops.push(...opsFromText('+', text, attribs, pool));
19911991
this._charBank.append(text);
19921992
return this;

0 commit comments

Comments
 (0)