mniehe / object-score

A javascript library to score objects based on validators
1 stars 0 forks source link

Unhandled error when scoring undefined #1

Open mniehe opened 7 years ago

mniehe commented 7 years ago

Example code:

const userModel = new ScoringModel('User');

userModel.field('username');
userModel.score(undefined);

results in:

/Users/mniehe/Desktop/dev/object-score/index.js:58
      const results = field.score(data[field.name]);
                                      ^

TypeError: Cannot read property 'username' of undefined