Skip to content
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

feature ✨ add arrayInclude 方法 #77

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

Jimmylxue
Copy link

arrayInclude

新增数组包含函数,判断数组1是否包含数组2,并补充测试用例

来自issues36

/**
 *
 * @desc 判断数组1是否包含数组2
 * @param {Array} arr1
 * @param {Array} arr2
 * @return {Boolean}
 */
function arrayInclude(arr1, arr2) {
	if (arr1 === arr2) return true
	if (arr1.length < arr2.length) {
		return false
	}
	return !arr2.some(item => {
		return !arr1.includes(item)
	})
}

@proYang
Copy link
Owner

proYang commented Nov 29, 2022

@Jimmylxue 牛啊,哥们,不过推荐用 lodash 吧。这个仓库的价值,更多在于学习封装一个工具库。:smile:

@Jimmylxue
Copy link
Author

@Jimmylxue 牛啊,哥们,不过推荐用 lodash 吧。这个仓库的价值,更多在于学习封装一个工具库。😄

好滴,我还以为有机会能够成为这个明星项目的 contributor 呢~😋

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants