utils.js 617 B

1234567891011
  1. 'use strict';
  2. const isStream = require('is-stream');
  3. // RxJS@6 symbol (https://github.com/sindresorhus/is-observable/issues/1#issuecomment-387843191)
  4. const symbolObservable = typeof Symbol === 'function' && Symbol.observable || '@@observable'; // eslint-disable-line no-mixed-operators
  5. const isObservable = obj => Boolean(obj && obj[symbolObservable] && obj === obj[symbolObservable]()) || require('is-observable')(obj);
  6. exports.isListr = obj => Boolean(obj && obj.setRenderer && obj.add && obj.run);
  7. exports.isObservable = obj => isObservable(obj);
  8. exports.isStream = obj => isStream(obj) && !isObservable(obj);