diff options
author | Johann-S <johann.servoire@gmail.com> | 2017-11-13 13:25:36 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-11-13 13:25:36 +0300 |
commit | 9a0bba9afa039308e84442a2b329bf64f5678a00 (patch) | |
tree | 0b4216889b0b675407b85d74692d8505ecfd0c82 /js/src/carousel.js | |
parent | 1354a929f911bfb8bf3a9b22c0f79fc0277c3a74 (diff) |
Object spread : less jQuery more ES6 (#24665)
Diffstat (limited to 'js/src/carousel.js')
-rw-r--r-- | js/src/carousel.js | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/js/src/carousel.js b/js/src/carousel.js index 10ed2203ed..ea443f189f 100644 --- a/js/src/carousel.js +++ b/js/src/carousel.js @@ -223,7 +223,10 @@ const Carousel = (($) => { // private _getConfig(config) { - config = $.extend({}, Default, config) + config = { + ...Default, + ...config + } Util.typeCheckConfig(NAME, config, DefaultType) return config } @@ -428,10 +431,16 @@ const Carousel = (($) => { static _jQueryInterface(config) { return this.each(function () { let data = $(this).data(DATA_KEY) - const _config = $.extend({}, Default, $(this).data()) + let _config = { + ...Default, + ...$(this).data() + } if (typeof config === 'object') { - $.extend(_config, config) + _config = { + ..._config, + ...config + } } const action = typeof config === 'string' ? config : _config.slide @@ -468,7 +477,10 @@ const Carousel = (($) => { return } - const config = $.extend({}, $(target).data(), $(this).data()) + const config = { + ...$(target).data(), + ...$(this).data() + } const slideIndex = this.getAttribute('data-slide-to') if (slideIndex) { |