Skip to content

Commit 1234898

Browse files
committed
refactor: improve syntax
1 parent c25f30e commit 1234898

File tree

1 file changed

+5
-15
lines changed

1 file changed

+5
-15
lines changed

js/src/sidebar.js

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,9 @@ const DATA_KEY = 'coreui.sidebar'
2828
const EVENT_KEY = `.${DATA_KEY}`
2929
const DATA_API_KEY = '.data-api'
3030

31-
const Default = {
32-
//
33-
}
31+
const Default = {}
3432

35-
const DefaultType = {
36-
//
37-
}
33+
const DefaultType = {}
3834

3935
const CLASS_NAME_BACKDROP = 'sidebar-backdrop'
4036
const CLASS_NAME_FADE = 'fade'
@@ -206,17 +202,11 @@ class Sidebar extends BaseComponent {
206202

207203
_getConfig(config) {
208204
config = {
209-
...this.constructor.Default,
205+
...Default,
210206
...Manipulator.getDataAttributes(this._element),
211-
...config
207+
...(typeof config === 'object' ? config : {})
212208
}
213-
214-
typeCheckConfig(
215-
NAME,
216-
config,
217-
this.constructor.DefaultType
218-
)
219-
209+
typeCheckConfig(NAME, config, DefaultType)
220210
return config
221211
}
222212

0 commit comments

Comments
 (0)