Skip to content

Latest commit

 

History

History
51 lines (42 loc) · 2.07 KB

File metadata and controls

51 lines (42 loc) · 2.07 KB

#Lodash Workout

##Some Tutorials

##The Excercise

Given this person schema:

 {
	firstName: string,
	lastName: string,
	age: number,
	skills: ['run', 'jump', 'swim', 'dance'],
	gender: string (male / female),
	married: boolean
}

adult schema extends person with:

children: {  // an object with key-value pairs, as firstName: person
	'childName': {person},
	'childName': {person},
	etc...
}

Given an array of adults perform the following tasks using lodash. Note that each task is a separate problems:

  1. filter by age under 30 and has the skills 'run' and 'swim'.
  2. filter by children who can swim or dance, and sort by gender and age.
  3. get an array of population, which contains all the people (adults and children) in the array.
  4. filter by people who have daughters and are not married.
  5. filter by married people who can jump.
  6. filter by people who have last name that starts with 'j' or later in the alphabet, and have married children.
  7. change the collection so that the name of each person is: name: {first: 'string', last: 'string'}
  8. instead of firstName and lastName
  9. get an array of all children
  10. get an array of just the ages: Let's say you want to do something when a certain event occurs. However, the event is fired very often when it happens. For example, when dragging something or scrolling, you want to perform some complex action, but you don't want it to happen so many times since it will slow down the UI.
  11. Create a function doSomething which will only execute at most 1/x times.
  12. Create a function which will only execute 1/x seconds.
  13. Given a function, get(url, data, successCallback) , create a function that will perform the get, but will always use a given url 'baseUrl' and specified data 'someData'.