

"use strict";
var Main = module.parent.exports;

Main.ActionHSET = function(Request){
  if(Request.length < 3){
    throw new Error(Main.MSG_ARGS_LESS);
  }
  Main.ValidateArguments(Main.ARGS_ODD, Request.length);
  let Key = Request.shift();
  let Value = this.Database.get(Key);
  try {
    Main.Validate(Main.VAL_HASH, 'HSET', Value);
  } catch(err){
    Value = new Map();
    this.Database.set(Key, Value);
  }
  for(let Number = 0; Number < Request.length; Number += 2){
    let HValue = Main.NormalizeType(Request[Number + 1]);
    Value.set(Request[Number], HValue);
  }
  return {Type: 'OK'};
};

Main.ActionHGET = function(Request){
  let Key = Request.shift();
  let Value = this.Database.get(Key);

  if(typeof Value !== 'undefined')
    Main.Validate(Main.VAL_HASH, 'HGET', Value);

  if(Request.length === 1){
    return Value && Value.get(Request[0]) || '';
  } else {
    return Request.map(function(Key){
      return Value && Value.get(Key) || '';
    });
  }
};
@@ -975,8 +975,424 @@
 ;%0A  %7D%0A%7D;
+%0A%0AMain.ActionHDEL = function(Request)%7B%0A  if(Request.length %3C 2)%7B%0A    throw new Error(Main.MSG_ARGS_LESS);%0A  %7D%0A  let Length = 0;%0A  let Key = Request.shift();%0A  let Value = this.Database.get(Key);%0A%0A  if(typeof Value !== 'undefined')%0A    Main.Validate(Main.VAL_HASH, 'HDEL', Value);%0A  else%0A    return Length;%0A%0A  Request.forEach(function(Name)%7B%0A    Value.delete(Name);%0A    Length ++;%0A  %7D.bind(this));%0A  return Length;%0A%7D;

Implement HDEL