提交 f39e6738 编写于 作者: J Joao Moreno

arrays.range

上级 c4de585c
......@@ -195,3 +195,13 @@ export function commonPrefixLength<T>(one: T[], other: T[], equals: (a: T, b: T)
export function flatten<T>(arr: T[][]): T[] {
return arr.reduce((r, v) => r.concat(v), []);
}
export function range(to: number, from = 0): number[] {
const result = [];
for (let i = from; i < to; i++) {
result.push(i);
}
return result;
}
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册