code: function apply_rule(name, gcase, rule) {
          var mod;
          if (gcase === 'nominative') mod = '.';
          else {
              for (var i = 0; i < predef.cases.length; i++) {
                  if (gcase === predef.cases[i]) {
                      mod = rule.mods[i - 1];
                      break;
                  }
  
              }
          }
  
          for (var i = 0; i < mod.length; i++) {
              var chr = mod[i];
              switch (chr) {
                  case '.':
                      break;
                  case '-':
                      name = name.substr(0, name.length - 1);
                      break;
                  default:
                      name += chr;
              }
          }
          return name;
      }
docs: Apply found rule to given name Move error throwing from this function to API method