How to use the array-flatten.flatten function in array-flatten

To help you get started, we’ve selected a few array-flatten examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github nearform / node-clinic-bubbleprof / visualizer / layout / positioning.js View on Github external
}

      const parentClump = this.clumpById[layoutNodeLeaf.parent ? layoutNodeLeaf.parent.id : 0]

      // TODO: find out why at aggregateNode level sometimes there's a node on its own like this
      if (!parentClump) continue

      if (parentClump.orientation !== 'center') {
        insertAtSide = this.orientationToInsertionSide[parentClump.orientation]
      }
      parentClump[insertAtSide](leaf.id)
      const updateSide = leaf === this.leadingLeaf ? 'center' : this.insertionSideToOrientation[insertAtSide]
      this.leavesOnSide[updateSide]++
    }

    this.order = arrayFlatten(roots.map(rootId => arrayFlatten(this.clumpById[rootId])))
  }
}
github nearform / node-clinic-bubbleprof / visualizer / draw / frames.js View on Github external
.on('mouseover', () => {
                const layoutNode = this.topmostUI.layout.findDataNode(frame.dataNode) || this.topmostUI.layout.rootLayoutNode
                this.topmostUI.highlightNode(layoutNode, frame.dataNode)
              })
              .on('mouseout', () => {
                this.topmostUI.highlightNode(null)
              })
              .on('click', () => {
                this.topmostUI.queueAnimation('jumpToFrame', (animationQueue) => {
                  const targetUI = this.topmostUI.jumpToNode(frame.dataNode, animationQueue)
                  this.topmostUI.originalUI.emit('navigation', { from: this.ui, to: targetUI })
                })
              })
          }

          header += `${arrayFlatten(frame).length} frames from `
          header += `${isThisNode ? 'this async operation' : `previous async operation "${frame.dataNode.name}"`}`
          header += `<div class="delays">${this.getDelaysText(frame.dataNode)}`
        } else if (frame.party) {
          d3Group.classed(frame.party[0], true)
            .classed('collapsed', frame.party[0] !== 'user')
          header += `${frame.length} frame${frame.length === 1 ? '' : 's'} from ${frame.party[1]}`
        }

        d3SubCollapseControl.html(header)
          .on('click', () =&gt; {
            d3Group.classed('collapsed', !d3Group.classed('collapsed'))
          })

        this.drawFrames(frame, d3Group)
      } else {
        d3AppendTo.append('pre')</div>
github blakeembrey / compose-middleware / src / index.ts View on Github external
function generate(handlers: Array&gt;) {
  const stack = flatten(handlers) as Middleware[];

  for (const handler of stack) {
    if ((typeof handler as any) !== "function") {
      throw new TypeError("Handlers must be a function");
    }
  }

  return function middleware(
    err: Error | null,
    req: T,
    res: U,
    done: Next
  ): V {
    let index = -1;

    function dispatch(pos: number, err?: Error | null): V {

array-flatten

Flatten nested arrays

MIT
Latest version published 5 years ago

Package Health Score

67 / 100
Full package analysis