{"size": 608, "ext": "js", "max_stars_repo_path": "example/service/user.js", "max_stars_repo_name": "amir-yahalom/moduli", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "example/service/user.js", "max_issues_repo_name": "amir-yahalom/moduli", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "example/service/user.js", "max_forks_repo_name": "amir-yahalom/moduli", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 22.5185185185, "max_line_length": 70, "alphanum_fraction": 0.6661184211}
var moduli = require('../../index');
var count = 0;

function UserService($db) {
    this.db = $db;
    count++;
}

UserService.prototype.addUser = function (data) {
    data = data || {};
    return this.db.setObj("users", data.email, data);
};

UserService.prototype.getUser = function (email) {
    return this.db.getObj("users", email);
};

UserService.prototype.getCount = function () {
    return count;
};

// creating objects on the fly
UserService.prototype.createUserEntity = function (data) {
    return moduli.get("User", [data.email, data.password, data.name]);
};

module.exports = UserService;