Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

fix tools function bug #1296

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
phony-ma wants to merge 1 commit into iview:master
base: master
Choose a base branch
Loading
from phony-ma:master
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions src/libs/tools.js
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,13 @@ export const forEach = (arr, fn) => {
* @description 得到两个数组的交集, 两个数组的元素为数值或字符串
*/
export const getIntersection = (arr1, arr2) => {
let len = Math.min(arr1.length, arr2.length)
if (!arr1.length || !arr2.length) return []
let len = arr1.length
let i = -1
let res = []
while (++i < len) {
const item = arr2[i]
if (arr1.indexOf(item) > -1) res.push(item)
const item = arr1[i]
if (arr2.indexOf(item) > -1) res.push(item)
}
return res
}
Expand Down

AltStyle によって変換されたページ (->オリジナル) /