Skip to content

Commit a3fce93

Browse files
committed
refactor: Use [...foo, bar] instead of foo.concat(bar)
1 parent 0d942c7 commit a3fce93

3 files changed

Lines changed: 4 additions & 4 deletions

File tree

src/doc/Document.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ export class Document<
205205
const keyToStr = (v: unknown) =>
206206
typeof v === 'number' || v instanceof String || v instanceof Number
207207
const asStr = replacer.filter(keyToStr).map(String)
208-
if (asStr.length > 0) replacer = replacer.concat(asStr)
208+
if (asStr.length > 0) replacer = [...replacer, ...asStr]
209209
nc = new NodeCreator(this, options, replacer)
210210
} else {
211211
options ??= replacer ?? undefined

src/parse/parser.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -641,7 +641,7 @@ export class Parser {
641641
})
642642
} else if (start.length > 0) {
643643
// Not actually at next item
644-
it.sep = it.sep.concat(start, this.sourceToken)
644+
it.sep = [...it.sep, ...start, this.sourceToken]
645645
} else {
646646
it.sep.push(this.sourceToken)
647647
}

src/schema/tags.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ export function getTags(
9898
const schemaTags = schemas.get(schemaName)
9999
if (schemaTags && !customTags) {
100100
return addMergeTag && !schemaTags.includes(merge)
101-
? schemaTags.concat(merge)
101+
? [...schemaTags, merge]
102102
: schemaTags.slice()
103103
}
104104

@@ -121,7 +121,7 @@ export function getTags(
121121
} else if (typeof customTags === 'function') {
122122
tags = customTags(tags.slice())
123123
}
124-
if (addMergeTag) tags = tags.concat(merge)
124+
if (addMergeTag) tags = [...tags, merge]
125125

126126
return tags.reduce<(CollectionTag | ScalarTag)[]>((tags, tag) => {
127127
const tagObj = typeof tag === 'string' ? tagsByName[tag] : tag

0 commit comments

Comments
 (0)