-
Notifications
You must be signed in to change notification settings - Fork 842
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
新增紧凑输出方法 #306
新增紧凑输出方法 #306
Conversation
let result = compact2array(arr[0], arr[1]); | ||
for (let i = 2, l = arr.length; i < l; i++) { | ||
result = compact2array(result, arr[i]); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let i = 0;
let result = [];
while (i < arr.length) {
result = compact2array(result, arr[i]);
i++;
}
lib/util.js
Outdated
} | ||
for (let i = 0, l = a1.length; i < l; i++) { | ||
for (let j = 0, m = a2.length; j < m; j++) { | ||
result.push(a1[i] + "," + a2[j]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里应该有更好的算法,再想想。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
修改了,你看看
CI 为什么少了很多用例? |
没有少吧,先前由于你的 |
@@ -39,11 +39,56 @@ function combo(arr) { | |||
return arr[0]; | |||
} | |||
let result = combo2array(arr[0], arr[1]); | |||
for (let i = 2, l = arr.length; i < l; i++) { | |||
for (let i = 2, l = arr.length; i < l; ++i) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
在这里 i++ 和 ++i 应该是没有区别的。
throw new Error("compact2array expect two array as parameters"); | ||
} | ||
if (!a1.length) { | ||
a1 = [undefined]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
为什么要加 undefined ?我怎么感觉代码越改越奇怪了呢?
少了的,你看看 master 分支的单测用例。 |
嗯嗯。对不起,修复了 |
✨ 新增紧凑输出
使用方法
或