https://caniuse.com/mdn-javascript_operators_spread
Unified · Split
| @@ -87,7 +87,8 @@ class App extends Events { · 86 unmodified lines | |||
| 87 | }, | 87 | }, |
| 88 | dataCallback(data) { | 88 | dataCallback(data) { |
| 89 | try { | 89 | try { |
| 90 | $.extend(data.user || (data.user = {}), app.settings.dump()); | 90 | data.user ||= {}; |
| 91 | Object.assign(data.user, app.settings.dump()); | ||
| 91 | if (data.user.docs) { | 92 | if (data.user.docs) { |
| 92 | data.user.docs = data.user.docs.split("/"); | 93 | data.user.docs = data.user.docs.split("/"); |
| 93 | } | 94 | } |
| @@ -185,7 +185,7 @@ app.Searcher = class Searcher extends Events { · 184 unmodified lines | |||
| 185 | 185 | ||
| 186 | constructor(options) { | 186 | constructor(options) { |
| 187 | super(); | 187 | super(); |
| 188 | this.options = $.extend({}, Searcher.DEFAULTS, options || {}); | 188 | this.options = { ...Searcher.DEFAULTS, ...(options || {}) }; |
| 189 | } | 189 | } |
| 190 | 190 | ||
| 191 | find(data, attr, q) { | 191 | find(data, attr, q) { |
| @@ -332,7 +332,7 @@ app.Searcher = class Searcher extends Events { · 140 unmodified lines | |||
| 332 | for (let j = this.scoreMap.length - 1; j >= 0; j--) { | 332 | for (let j = this.scoreMap.length - 1; j >= 0; j--) { |
| 333 | var objects = this.scoreMap[j]; | 333 | var objects = this.scoreMap[j]; |
| 334 | if (objects) { | 334 | if (objects) { |
| 335 | results.push.apply(results, objects); | 335 | results.push(...objects); |
| 336 | } | 336 | } |
| 337 | } | 337 | } |
| 338 | return results.slice(0, this.options.max_results); | 338 | return results.slice(0, this.options.max_results); |
| @@ -369,7 +369,7 @@ app.SynchronousSearcher = class SynchronousSearcher extends app.Searcher { · 30 unmodified lines | |||
| 369 | if (!this.allResults) { | 369 | if (!this.allResults) { |
| 370 | this.allResults = []; | 370 | this.allResults = []; |
| 371 | } | 371 | } |
| 372 | this.allResults.push.apply(this.allResults, this.getResults()); | 372 | this.allResults.push(...this.getResults()); |
| 373 | } | 373 | } |
| 374 | return super.match(...arguments); | 374 | return super.match(...arguments); |
| 375 | } | 375 | } |
| @@ -421,18 +421,6 @@ $.smoothScroll = function (el, end) { · 420 unmodified lines | |||
| 421 | // Utilities | 421 | // Utilities |
| 422 | // | 422 | // |
| 423 | 423 | ||
| 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 | |||
| 436 | $.makeArray = function (object) { | 424 | $.makeArray = function (object) { |
| 437 | if (Array.isArray(object)) { | 425 | if (Array.isArray(object)) { |
| 438 | return object; | 426 | return object; |
| @@ -573,10 +561,7 @@ const HIGHLIGHT_DEFAULTS = { · 134 unmodified lines | |||
| 573 | }; | 561 | }; |
| 574 | 562 | ||
| 575 | $.highlight = function (el, options) { | 563 | $.highlight = function (el, options) { |
| 576 | if (options == null) { | 564 | options = { ...HIGHLIGHT_DEFAULTS, ...(options || {}) }; |
| 577 | options = {}; | ||
| 578 | } | ||
| 579 | options = $.extend({}, HIGHLIGHT_DEFAULTS, options); | ||
| 580 | el.classList.add(options.className); | 565 | el.classList.add(options.className); |
| 581 | setTimeout(() => el.classList.remove(options.className), options.delay); | 566 | setTimeout(() => el.classList.remove(options.className), options.delay); |
| 582 | }; | 567 | }; |
| @@ -10,7 +10,7 @@ app.views.Notif = class Notif extends app.View { · 9 unmodified lines | |||
| 10 | constructor(type, options) { | 10 | constructor(type, options) { |
| 11 | super(); | 11 | super(); |
| 12 | this.type = type; | 12 | this.type = type; |
| 13 | this.options = $.extend({}, this.constructor.defaultOptions, options || {}); | 13 | this.options = { ...this.constructor.defaultOptions, ...(options || {}) }; |
| 14 | this.init0(); // needs this.options | 14 | this.init0(); // needs this.options |
| 15 | this.refreshElements(); | 15 | this.refreshElements(); |
| 16 | } | 16 | } |