Created
December 9, 2014 19:30
-
-
Save brito/6f7dddc5a24194f703ef to your computer and use it in GitHub Desktop.
Tiny cross indexer
This file contains hidden or 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
Records = []; | |
function Record(data){ | |
if (data.map) | |
return data.map(Record); | |
// defaults | |
var obj = { | |
id: +new Date, | |
updated: new Date, | |
created: new Date, | |
status: 'assigned', | |
assignee: 'michael.trowler' | |
}; | |
// overwrite defaults | |
for (var attr in data) | |
obj[attr] = data[attr]; | |
// as array | |
Records.push(obj); | |
// as map | |
for (var attr in obj){ | |
Records[attr] = (Records[attr] || {}); | |
Records[attr][obj[attr]] = (Records[attr][obj[attr]] || []); | |
Records[attr][obj[attr]].push(obj); | |
} | |
} | |
var begin = new Date; | |
console.info('Loading Records...'); | |
new Record([ | |
{ type: 'Child', | |
id:'UTAE031943', | |
name: 'Jerry', | |
photo: 'sample/jerry.jpg', | |
age: 17, | |
gender: 'male', | |
race: 'Hispanic/Latino', | |
about: 'Jerry is a hard working, responsible, and social young man. He is well-liked by those who know him and has a very caring personality. A creative guy, Jerry aspires to attend college for clothing design as he has a great passion for it! Jerry is a big fan of basketball and enjoys shooting hoops with his brothers in his free time.\nJerry currently attends the eleventh grade and would benefit from academically supportive parents.' | |
}, { type: 'Child', | |
id: 'UTAE031935', | |
name: 'Liliette', | |
photo: 'sample/liliette.jpg', | |
age: 16, | |
gender: 'female', | |
race: 'Hispanic/Latino', | |
about: 'Lili is described as affable and good-natured. She is very nurturing and playful with her siblings and finds much fulfillment and joy in her relationships with them. Lili loves to do hair and makeup and hopes to attend cosmetology school! She can often be found practicing hair and makeup on her younger siblings.\nLili currently attends the tenth grade and would benefit from academically supportive parents.' | |
}, { type: 'Child', | |
id: 'UTAE031936', | |
name: 'Jesus', | |
photo: 'sample/jesus.jpg', | |
age: 15, | |
gender: 'male', | |
race: 'Hispanic/Latino', | |
about: 'Jesus is well-liked by those around him. He gets along great with others and really enjoys spending time with his two brothers that are close to his age. Jesus can often be found trying out a new trick at the skate park as he practices and improves daily. He dreams of becoming a sponsored pro-skateboarder one day!\nJesus currently attends the ninth grade and would benefit from academically supportive parents.' | |
}, { type: 'Child', | |
id: 'UTAE031937', | |
name: 'Mark', | |
photo: 'sample/mark.jpg', | |
age: 12, | |
gender: 'male', | |
race: 'Hispanic/Latino', | |
about: 'Mark is an active kiddo who enjoys spending time with friends! He is a positive role model to his peers and gets along well with others. Mark loves sports and has a natural talent for basketball. He dreams of one day playing basketball professionally!\nMark currently attends the fifth grade. He is doing well in school and would excel in an academically supportive environment.' | |
}, { type: 'Child', | |
id: 'UTAE031938', | |
name: 'Luis', | |
photo: 'sample/luis.jpg', | |
age: 11, | |
gender: 'male', | |
race: 'Hispanic/Latino', | |
about: 'Luis is a cheerful boy who loves spending time with others. He is outgoing and isn?t afraid to ask questions and share information. He is a big fan of sports which he enjoys both watching and playing! Basketball with his siblings is his favorite, and he has recently been getting into monster trucks too! He would love to one day become a football player!\nLuis is currently attending the fifth grade and does well in school. He would do well in an encouraging environment.' | |
}, { type: 'Child', | |
id: 'UTAE031939', | |
name: 'Selena', | |
photo: 'sample/selena.jpg', | |
age: 10, | |
gender: 'female', | |
race: 'Hispanic/Latino', | |
about: 'Selena is a good-natured girl who loves to learn and teach! She is always looking out for her siblings and enjoys playing with them. Selena is always looking for ways that she can help others. When she grows up she would like to become a nurse or a teacher!\nSelena currently attends the fourth grade and is motivated to do well in school. Selena would do well with encouraging parents that can help her reach her goals.' | |
}, { type: 'Child', | |
id: 'UTAE031940', | |
name:'Christian', | |
photo: 'sample/christian.jpg', | |
age: 8, | |
gender: 'male', | |
race: 'Hispanic/Latino', | |
about: 'Christian is a sweet kiddo who is very interactive with his family. He is a likeable young man with a disarming smile! Like his brothers, Christian loves sports and dreams of becoming a basketball or football player when he grows up. He is very curious and inquisitive and likes to learn about how things work.\nChristian is currently attending third grade and is making progress. He would benefit from a motivating, encouraging environment.' | |
}, { type: 'Child', | |
id: 'UTAE031941', | |
name: 'Vanessa', | |
photo: 'sample/vanessa.jpg', | |
age: 7, | |
gender: 'female', | |
race: 'Hispanic/Latino', | |
about: 'Vanessa loves to have fun and interact with both adults and peers. She is described by those who know her as observant and engaged in life. She has natural optimism that is contagious to those around her. Vanessa enjoys spending time with her siblings and is great at sharing and getting along with each of them.\nVanessa currently attends the first grade. She works hard in school and would benefit from a motivating and supportive family.' | |
}, { type: 'Child', | |
casenubmer: 'UTAE031942', | |
name: 'Alexsy', | |
photo: 'sample/alexsy.jpg', | |
age: 5, | |
gender: 'male', | |
race: 'Hispanic/Latino', | |
about: 'Alexsy, who likes to go by Alex, is the youngest of his nine siblings! He loves spending time with his brothers and sisters and always has a new game to play. A charming young kiddo, Alex is very social and is great at making friends. He is described as good-natured and a great friend by those who know him.\nAlex is attending preschool and is doing great learning his letters and numbers!' | |
} | |
]); | |
console.info('Records loaded in %dms', new Date - begin); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment