How to use the zen-observable.from function in zen-observable

To help you get started, we’ve selected a few zen-observable 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 kefirjs / kefir / test / specs / es-observable.js View on Github external
it('outputs a compatible Observable', done => {
    const a = stream()
    const values = []
    const observable = Observable.from(a)
    observable.subscribe({
      next(x) {
        values.push(x)
      },
      complete(x) {
        expect(values).toEqual([1, 2, 3])
        done()
      },
    })
    send(a, [1, 2, 3, ''])
  })
github DefinitelyTyped / DefinitelyTyped / types / zen-observable / zen-observable-tests.ts View on Github external
observer.complete();
})
    .subscribe(val => assert(typeof val === 'number'));

/**
 * Observable.of
 */

Observable.of(1, 2, 3)
    .subscribe(val => assert(typeof val === 'number'));

/**
 * Observable.from
 */

Observable.from(Observable.of(1, 2, 3))
    .subscribe(val => assert(typeof val === 'number'));

Observable.from([1, 2, 3])
    .subscribe(val => assert(typeof val === 'number'));

Observable.from({
    subscribe(observer: ZenObservable.SubscriptionObserver) {
        [1, 2, 3].forEach(one => observer.next(one));
        observer.complete();
    },
    [Symbol.observable](this: ZenObservable.ObservableLike) {
        return this;
    }
})
    .subscribe(val => assert(typeof val === 'number'));
github DefinitelyTyped / DefinitelyTyped / types / zen-observable / zen-observable-tests.ts View on Github external
/**
 * Observable.of
 */

Observable.of(1, 2, 3)
    .subscribe(val => assert(typeof val === 'number'));

/**
 * Observable.from
 */

Observable.from(Observable.of(1, 2, 3))
    .subscribe(val => assert(typeof val === 'number'));

Observable.from([1, 2, 3])
    .subscribe(val => assert(typeof val === 'number'));

Observable.from({
    subscribe(observer: ZenObservable.SubscriptionObserver) {
        [1, 2, 3].forEach(one => observer.next(one));
        observer.complete();
    },
    [Symbol.observable](this: ZenObservable.ObservableLike) {
        return this;
    }
})
    .subscribe(val => assert(typeof val === 'number'));

Observable.from({
    [Symbol.observable]() {
        return Observable.of(1, 2, 3);
github aws-amplify / amplify-js / packages / pubsub / src / Providers / AWSAppSyncProvider.ts View on Github external
client.unsubscribe(t);
						this._topicClient.delete(t);

						if (
							!Array.from(this._topicClient.values()).some(c => c === client)
						) {
							this.disconnect(client.clientId);
						}
					}

					this._topicObservers.delete(t);
				});
			};
		});

		return Observable.from(result).map(value => {
			const topic = this.getTopicForValue(value);
			const alias = this._topicAlias.get(topic);

			value.data = Object.entries(value.data).reduce(
				(obj, [origKey, val]) => (
					(obj[(alias || origKey) as string] = val), obj
				),
				{}
			);

			return value;
		});
	}
}
github mirabeau-nl / frontend-boilerplate / tasks / codestyle.js View on Github external
export function codestyle(cb) {
  return Observable.from(globVinyl(config.glob))
    .filter(makeFilter(config.ignorefile))
    .map(readVinyl)
    .map(prettierFormat)
    .map(writeVinyl)
    .reduce(reduceResult)
    .subscribe(result => printResult(result, cb))
}
github mirabeau-nl / frontend-boilerplate / tasks / codestyle.js View on Github external
export function codestyleIsValid(cb) {
  return Observable.from(globVinyl(config.glob))
    .filter(makeFilter(config.ignorefile))
    .map(readVinyl)
    .map(prettierCheck)
    .reduce(reduceResult)
    .subscribe(result => printResult(result, cb))
}

zen-observable

An Implementation of ES Observables

MIT
Latest version published 2 years ago

Package Health Score

70 / 100
Full package analysis

Similar packages