loop-guard

    0.0.0 • Public • Published

    Loop Guard guards against loops during tree/graph traversal.

    Usage

     
    var createGuard = require('loop-guard');
     
    var guard = createGuard();
     
    function visitNode(node) {
      guard.visit(node);
     
      for (var i=0; i < node.children.length; i++) {
        var child = node.children[i];
     
        if (guard.canVisit(child)) {
          visitNode(child);
        }
      }
     
      guard.leave(node);
    }
     

    Install

    npm i loop-guard

    DownloadsWeekly Downloads

    0

    Version

    0.0.0

    License

    MIT

    Last publish

    Collaborators

    • dicksont