Created
July 1, 2016 13:35
-
-
Save chuck0523/e638a8096b4fb0b573738ca807f593c8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export class User {} | |
export class Job {} | |
let userNames = ['chuck', 'you', 'him'] | |
let users = userNames.map((name, id) => { | |
let user = new User() | |
user.id = `${id}` | |
user.name = name | |
return user | |
}) | |
let jobList = [ | |
[0, 'manager', 500], | |
[1, 'developer', 400], | |
[2, 'designer', 300] | |
] | |
let jobs = jobList.map((job, id) => { | |
let newJob = new Job() | |
newJob.id = `${id}` | |
newJob.name = job[1] | |
newJob.salary = `${job[2]}` | |
return newJob | |
}) | |
export function getChuck() { return users[0] } | |
export function getUser(id) { return users.find((user) => user.id === id) } | |
export function getUsers() { return users } | |
export function getJob(id) { return jobs.find(j => j.id === id) } | |
export function getJobs() { return jobs } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment