Reduce array allocations from merging categories (#8453)

Merge pull request 8453
This commit is contained in:
Ashwin Maroli 2020-11-04 21:01:00 +05:30 committed by GitHub
parent 02d25d1cf2
commit bf18b27e2a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 1 deletions

View File

@ -453,7 +453,10 @@ module Jekyll
def merge_categories!(other)
if other.key?("categories") && !other["categories"].nil?
other["categories"] = other["categories"].split if other["categories"].is_a?(String)
other["categories"] = (data["categories"] || []) | other["categories"]
if data["categories"].is_a?(Array)
other["categories"] = data["categories"] | other["categories"]
end
end
end