loosen tangle.slice() arguments

This commit is contained in:
Andre Staltz 2023-12-15 14:38:02 +02:00
parent f38b293c76
commit fa15271fdf
No known key found for this signature in database
GPG Key ID: 9EDE23EA7E8A4890
2 changed files with 4 additions and 4 deletions

View File

@ -140,11 +140,11 @@ class DBTangle extends MsgV3.Tangle {
} }
/** /**
* @param {Array<string>} minSet * @param {Array<string>=} minSet
* @param {Array<string>} maxSet * @param {Array<string>=} maxSet
* @returns {Array<Msg>} * @returns {Array<Msg>}
*/ */
slice(minSet, maxSet = []) { slice(minSet = [], maxSet = []) {
const minSetGood = minSet.filter((msgID) => this.has(msgID)) const minSetGood = minSet.filter((msgID) => this.has(msgID))
const maxSetGood = maxSet.filter((msgID) => this.has(msgID)) const maxSetGood = maxSet.filter((msgID) => this.has(msgID))
const minSetTight = this.getMinimumAmong(minSetGood) const minSetTight = this.getMinimumAmong(minSetGood)

View File

@ -279,7 +279,7 @@ test('getTangle()', async (t) => {
await t.test('Tangle.slice', (t) => { await t.test('Tangle.slice', (t) => {
{ {
const msgs = tangle.slice([], []) const msgs = tangle.slice()
const texts = msgs.map((msg) => msg.data?.text) const texts = msgs.map((msg) => msg.data?.text)
assert.deepEqual(texts, [ assert.deepEqual(texts, [
'root', 'root',