Skip to content

Better debug in javascript #325

Description

@ftaiolivista

When working in Js without Typescript help the lib don't warn you when passing bad values to stream constructor

A classic example is merging or composing null values:

const stream1 = xs.never()
const stream2 = xs.never()
const stream3 = null
xs.merge(stream1, stream2, stream3)

The code don't give error on network setup but only at network run time without telling where the the problem came for.

Would not be bad to add a lite type check on merge and combine, something like

var Merge = /** @class */ (function () {
    function Merge(insArr) {
        // Are all operand streams?
        for (const v of insArr) {
            if (!v || !v._add) {
                throw Error('Must be a Stream')
            }
        }
       //=================
        this.type = 'merge';
        this.insArr = insArr;
        this.out = NO;
        this.ac = 0;
    }

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions