UNPKG

@giorgi-g/csv-parser

Version:

CSV parser for migrations with Sequelizer

44 lines (43 loc) 1.27 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Profile = void 0; class Profile { constructor(row) { this.id = 0; this.firstName = ''; this.lastName = ''; this.email = ''; this.gender = 2; this.phoneNumber = ''; this.birthday = new Date(); this.mapGender = (status) => { switch (status) { case "MALE": return 0; case "FEMALE": return 1; default: return 2; } }; this.id = parseInt(row['ID'], 10); this.firstName = row['FIRST_NAME']; this.lastName = row['LAST_NAME']; this.email = row['EMAIL']; this.gender = this.mapGender(row['GENDER'].toUpperCase()); this.phoneNumber = row['PHONE_NUMBER']; this.birthday = new Date(row['BIRTHDAY']); } get profile() { return { id: this.id, firstName: this.firstName, lastName: this.lastName, email: this.email, gender: this.gender, phoneNumber: this.phoneNumber, birthday: this.birthday, }; } } exports.Profile = Profile;