stream(1)
value.end(true) // set to ended state

console.log(value(1)) // logs 1

value(2)
console.log(value()) // logs 2
</code></pre>
<p>Ending a stream can be useful in cases where a stream has a limited lifetime (for example, reacting to <code>mousemove</code> events only while a DOM element is being dragged, but not after it&#39;s been dropped).</p>
<hr>
<h3 id="serializing-streams"><a href="#serializing-streams">Serializing streams</a></h3>
<p>Streams implement a <code>.toJSON()</code> method. When a 