How to use the ix/iterable.from function in ix

To help you get started, we’ve selected a few ix examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ReactiveX / IxJS / spec / iterable / from-spec.ts View on Github external
test('Iterable#from from generator', () => {
  const xs = getData();
  const res = from(xs);

  const it = res[Symbol.iterator]();
  hasNext(it, 1);
  hasNext(it, 2);
  hasNext(it, 3);
  noNext(it);
});
github ReactiveX / IxJS / spec / iterable-operators / todomstream-spec.ts View on Github external
test(`yields Objects`, async () => {
        const expected = from(expectedObjects);
        const actual = objectsItr().pipe(toDOMStream());
        await expect(actual).toEqualStream(expected, compare);
      });
    });
github ReactiveX / IxJS / spec / iterable / from-spec.ts View on Github external
test('Iterable#from from iterator', () => {
  const xs = getData();
  const res = from({ next: () => xs.next() });

  const it = res[Symbol.iterator]();
  hasNext(it, 1);
  hasNext(it, 2);
  hasNext(it, 3);
  noNext(it);
});
github ReactiveX / IxJS / spec / iterable-operators / todomstream-spec.ts View on Github external
test(`yields Buffers`, async () => {
        const expected = from(expectedBuffers);
        const actual = buffersItr().pipe(toDOMStream());
        await expect(actual).toEqualStream(expected, compare);
      });
      test(`yields Objects`, async () => {
github ReactiveX / IxJS / spec / iterable-operators / todomstream-spec.ts View on Github external
test(`yields Strings`, async () => {
        const expected = from(expectedStrings);
        const actual = stringsItr().pipe(toDOMStream());
        await expect(actual).toEqualStream(expected, compare);
      });
      test(`yields Buffers`, async () => {
github ReactiveX / IxJS / spec / iterable / from-spec.ts View on Github external
test('Iterable#from from empty array/iterable', () => {
  const xs: number[] = [];
  const res = from(xs);

  const it = res[Symbol.iterator]();
  noNext(it);
});
github ReactiveX / IxJS / spec / iterable / from-spec.ts View on Github external
test('Iterable#from from array-like', () => {
  const xs = { length: 3 };
  const res = from(xs);

  const it = res[Symbol.iterator]();
  hasNext(it, undefined);
  hasNext(it, undefined);
  hasNext(it, undefined);
  noNext(it);
});
github ReactiveX / IxJS / spec / iterable-operators / todomstream-spec.ts View on Github external
  const stringsItr = () => from([1, 2, 3]).pipe(map(i => `${i}`));
  const buffersItr = () => stringsItr().pipe(map(val => Buffer.from(val)));