提交 37402c18 编写于 作者: J João Moreno

add Iterable.empty()

上级 6b3db5ba
......@@ -36,6 +36,11 @@ export interface NativeIterator<T> {
export namespace Iterable {
const _empty: Iterable<any> = Object.freeze([]);
export function empty<T>(): Iterable<T> {
return _empty;
}
export function first<T>(iterable: Iterable<T>): T | undefined {
return iterable[Symbol.iterator]().next().value;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册