Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/twbs/bootstrap.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXhmikosR <xhmikosr@gmail.com>2020-11-03 17:15:16 +0300
committerXhmikosR <xhmikosr@gmail.com>2020-11-14 16:54:50 +0300
commiteaf616c6538847561cbfd60ce7fc54cea16d8a1b (patch)
tree2f85dca6dc5052317ed438310630253a5e34f137
parent53ec604eb1bc8860128db832d8820f76531e1208 (diff)
Use `Array.find` instead of `Array.filter`
-rw-r--r--.eslintrc.json1
-rw-r--r--js/src/collapse.js4
2 files changed, 2 insertions, 3 deletions
diff --git a/.eslintrc.json b/.eslintrc.json
index b53ecb1a85..ec6aa589c3 100644
--- a/.eslintrc.json
+++ b/.eslintrc.json
@@ -49,7 +49,6 @@
"unicorn/no-null": "off",
"unicorn/no-unused-properties": "error",
"unicorn/no-useless-undefined": "off",
- "unicorn/prefer-array-find": "off",
"unicorn/prefer-dataset": "off",
"unicorn/prefer-node-append": "off",
"unicorn/prefer-node-remove": "off",
diff --git a/js/src/collapse.js b/js/src/collapse.js
index f3ca86f366..2ddcb0c047 100644
--- a/js/src/collapse.js
+++ b/js/src/collapse.js
@@ -150,8 +150,8 @@ class Collapse {
const container = SelectorEngine.findOne(this._selector)
if (actives) {
- const tempActiveData = actives.filter(elem => container !== elem)
- activesData = tempActiveData[0] ? Data.getData(tempActiveData[0], DATA_KEY) : null
+ const tempActiveData = actives.find(elem => container !== elem)
+ activesData = tempActiveData ? Data.getData(tempActiveData, DATA_KEY) : null
if (activesData && activesData._isTransitioning) {
return