code: function (person, gcase) {
          var result = {};
          // gender detection
          if (person.gender != null) {
              if (!contains(predef.genders, person.gender))
                  throw new Error('Invalid gender: ' + person.gender);
              result.gender = person.gender;
          } else if (person.middle != null) {
              result.gender = petrovich.detect_gender(person.middle);
          } else {
              throw new Error('Unknown gender');
          }
          if (!contains(predef.cases, gcase))
              throw new Error('Invalid case: ' + gcase);
          // look over possible names of properties, inflect them and add to result object
          for (var i = 0; i < predef.nametypes.length; i++) {
              var nametype = predef.nametypes[i];
              if (person[nametype] != null) {
                  result[nametype] =
                      inflect(result.gender, person[nametype], gcase, nametype + 'name');
              }
          }
          return result;
      }
docs: First use means: var person = { gender: 'female', first: 'Маша' }; petrovich(person, 'dative');