{"size": 1332, "ext": "js", "max_stars_repo_path": "src/source/core.js", "max_stars_repo_name": "AugustinLF/most", "max_stars_repo_stars_event_min_datetime": "2015-01-01T22:23:47.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-29T09:46:02.000Z", "max_issues_repo_path": "src/source/core.js", "max_issues_repo_name": "AugustinLF/most", "max_issues_repo_issues_event_min_datetime": "2015-01-04T19:01:39.000Z", "max_issues_repo_issues_event_max_datetime": "2021-10-07T17:22:55.000Z", "max_forks_repo_path": "src/source/core.js", "max_forks_repo_name": "AugustinLF/most", "max_forks_repo_forks_event_min_datetime": "2015-01-26T06:11:15.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-09T13:39:37.000Z"}
{"max_stars_count": 3738, "max_issues_count": 374, "max_forks_count": 315, "avg_line_length": 19.3043478261, "max_line_length": 78, "alphanum_fraction": 0.6876876877}
/** @license MIT License (c) copyright 2010-2016 original author or authors */
/** @author Brian Cavalier */
/** @author John Hann */

import Stream from '../Stream'
import * as dispose from '../disposable/dispose'
import PropagateTask from '../scheduler/PropagateTask'

/**
 * Stream containing only x
 * @param {*} x
 * @returns {Stream}
 */
export function of (x) {
  return new Stream(new Just(x))
}

function Just (x) {
  this.value = x
}

Just.prototype.run = function (sink, scheduler) {
  return scheduler.asap(new PropagateTask(runJust, this.value, sink))
}

function runJust (t, x, sink) {
  sink.event(t, x)
  sink.end(t, void 0)
}

/**
 * Stream containing no events and ends immediately
 * @returns {Stream}
 */
export function empty () {
  return EMPTY
}

function EmptySource () {}

EmptySource.prototype.run = function (sink, scheduler) {
  var task = PropagateTask.end(void 0, sink)
  scheduler.asap(task)

  return dispose.create(disposeEmpty, task)
}

function disposeEmpty (task) {
  return task.dispose()
}

var EMPTY = new Stream(new EmptySource())

/**
 * Stream containing no events and never ends
 * @returns {Stream}
 */
export function never () {
  return NEVER
}

function NeverSource () {}

NeverSource.prototype.run = function () {
  return dispose.empty()
}

var NEVER = new Stream(new NeverSource())
