INNER CODE UNIT · TypeScript

Node

zhenorzz/goploy · web/src/components/JSONTree/index.ts:168

  function Node(label, val, isLast) {
    const nodeType = utils.getType(val)

    if (nodeType in Node.CONSTRUCTORS) {
      return new Node.CONSTRUCTORS[nodeType](label, val, isLast)
    } else {
      throw new Error('Bad type: ' + utils.getClass(val))
    }
  }

  Node.CONSTRUCTORS = {
    boolean: NodeBoolean,
    number: NodeNumber,
    string: NodeString,
    null: NodeNull,
    object: NodeObject,
    array: NodeArray,
  }

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…