BSick7 edited this page May 10, 2014 · 8 revisions

All methods are scoped to exjs namespace. The extension method en() is attached to Array.prototype to allow for terse usage.

The IEnumerable pattern is an imitation of C#'s IEnumerable pattern:

interface IEnumerable<T> {
  getEnumerator(): IEnumerator<T>;
}
interface IEnumerator<T> {
  current: T;
  moveNext(): boolean;
}

These interfaces allow enumerable methods to defer until execution is necessary.

interface ISomething {
  member1: any;
}
var arr: ISomething[] = [];
// ...Fill array
var e = arr.en()
  .select(x => x.member1);
// At this point, we have not enumerated
var m1s = e.toArray();
// Now we have enumerated and projected 'member1' to a separate array.

API Reference

You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.