Skip to content

Commit ff7a10c

Browse files
committed
1 parent 416363a commit ff7a10c

4 files changed

Lines changed: 7 additions & 21 deletions

File tree

assets/javascripts/app/app.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,8 @@ class App extends Events {
8787
},
8888
dataCallback(data) {
8989
try {
90-
$.extend(data.user || (data.user = {}), app.settings.dump());
90+
data.user ||= {};
91+
Object.assign(data.user, app.settings.dump());
9192
if (data.user.docs) {
9293
data.user.docs = data.user.docs.split("/");
9394
}

assets/javascripts/app/searcher.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ app.Searcher = class Searcher extends Events {
185185

186186
constructor(options) {
187187
super();
188-
this.options = $.extend({}, Searcher.DEFAULTS, options || {});
188+
this.options = { ...Searcher.DEFAULTS, ...(options || {}) };
189189
}
190190

191191
find(data, attr, q) {
@@ -332,7 +332,7 @@ app.Searcher = class Searcher extends Events {
332332
for (let j = this.scoreMap.length - 1; j >= 0; j--) {
333333
var objects = this.scoreMap[j];
334334
if (objects) {
335-
results.push.apply(results, objects);
335+
results.push(...objects);
336336
}
337337
}
338338
return results.slice(0, this.options.max_results);
@@ -369,7 +369,7 @@ app.SynchronousSearcher = class SynchronousSearcher extends app.Searcher {
369369
if (!this.allResults) {
370370
this.allResults = [];
371371
}
372-
this.allResults.push.apply(this.allResults, this.getResults());
372+
this.allResults.push(...this.getResults());
373373
}
374374
return super.match(...arguments);
375375
}

assets/javascripts/lib/util.js

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -421,18 +421,6 @@ $.smoothScroll = function (el, end) {
421421
// Utilities
422422
//
423423

424-
$.extend = function (target, ...objects) {
425-
for (var object of objects) {
426-
if (object) {
427-
for (var key in object) {
428-
var value = object[key];
429-
target[key] = value;
430-
}
431-
}
432-
}
433-
return target;
434-
};
435-
436424
$.makeArray = function (object) {
437425
if (Array.isArray(object)) {
438426
return object;
@@ -573,10 +561,7 @@ const HIGHLIGHT_DEFAULTS = {
573561
};
574562

575563
$.highlight = function (el, options) {
576-
if (options == null) {
577-
options = {};
578-
}
579-
options = $.extend({}, HIGHLIGHT_DEFAULTS, options);
564+
options = { ...HIGHLIGHT_DEFAULTS, ...(options || {}) };
580565
el.classList.add(options.className);
581566
setTimeout(() => el.classList.remove(options.className), options.delay);
582567
};

assets/javascripts/views/misc/notif.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ app.views.Notif = class Notif extends app.View {
1010
constructor(type, options) {
1111
super();
1212
this.type = type;
13-
this.options = $.extend({}, this.constructor.defaultOptions, options || {});
13+
this.options = { ...this.constructor.defaultOptions, ...(options || {}) };
1414
this.init0(); // needs this.options
1515
this.refreshElements();
1616
}

0 commit comments

Comments
 (0)