code: function seqActions(actions, seed, onCompleted) {
    var index = 0;
  
    function invokeNext(v) {
      var action = actions[index];
      action(v, function (res) {
        index = index + 1;
        if (index < actions.length) {
          invokeNext(res);
        } else {
          onCompleted(res);
        }
      });
    }
  
    invokeNext(seed);
  }
docs: chain a sequence of asynchronous actions