stream: Removed valueOf & toString methods (fixes #2150) (#2151)

* stream: Removed `valueOf` & `toString` methods (fixes #2150)

* Update stream documentation
This commit is contained in:
Barney Carroll 2018-05-15 23:01:30 +01:00 committed by Pierre-Yves Gérardy
parent 4823369abe
commit e1a50890e9
5 changed files with 9 additions and 34 deletions

View file

@ -19,7 +19,7 @@ function initStream(stream) {
stream.constructor = createStream
stream._state = {id: guid++, value: undefined, state: 0, derive: undefined, recover: undefined, deps: {}, parents: [], endStream: undefined, unregister: undefined}
stream.map = stream["fantasy-land/map"] = map, stream["fantasy-land/ap"] = ap, stream["fantasy-land/of"] = createStream
stream.valueOf = valueOf, stream.toJSON = toJSON, stream.toString = valueOf
stream.toJSON = toJSON
Object.defineProperties(stream, {
end: {get: function() {
@ -101,7 +101,6 @@ function unregisterStream(stream) {
function map(fn) {return combine(function(stream) {return fn(stream())}, [this])}
function ap(stream) {return combine(function(s1, s2) {return s1()(s2())}, [stream, this])}
function valueOf() {return this._state.value}
function toJSON() {return this._state.value != null && typeof this._state.value.toJSON === "function" ? this._state.value.toJSON() : this._state.value}
function valid(stream) {return stream._state }