...lately this week I was given a task to work SWAPI (starwarsapi)... and this api is kinda complex than anything I have worked on before... now listen, not complex at first, but the task made it complex;
- Fetch a list of films from the SWAPI -(easy pissy!๐ rii)
Movie names in the dropdown to be sorted by release date from earliest to newest (not bad init?๐)
There should be no movie selected initially and the app should
show the Star Wars logo instead of movie information (just set and initial state ? ๐ฅฑ)The opening crawl of the selected movie should be
animated, a simple scrolling marquee text would be
sufficient๐
.... Problem begins... considering the fact that I didn't plan quite while before dabbling into the task, all the planning w sin my head tho little... this last part got me sleepless..
โ All characters that appear in that movie should be listed
showing name, gender, and height in the form of a table.
โ Gender can be shown as an icon or abbreviation to save
horizontal space. Character list can be sorted by clicking on the
table headers.
โ Clicking on the same header twice toggles the sort order by the
field between ascending and descending.
โ There should also be a gender filter selection right above the list so that either all characters are listed or only the selected gender are listed.
โ The last row of the table should show the total number of
characters currently visible on the list.
โ The last row should also show the sum of the heights of the
characters currently visible.
โ The sum of heights should be shown both in cm and in
feet/inches in parenthesis, for example, 170 cm (5ft/6.93in)
....Looking at the above task, I finally completed the task in 3days, what I estimated to take me only 6-10hours, after many #stack-overflow copy and paste, trials and errors, I came across the _js (Underscore js) at Stack overflow, someone was answering a question similar to what I was facing currently performing the task... and man, I have never been this happy before finding a solution.
It helped as a utility-belt library for JavaScript that provides support for the usual functional suspects (each, map, reduce, filter...) without extending any core JavaScript objects.
After the 3day ling struggle underscore Js came to my rescue...
Nice!๐
Thanks for reading...
Top comments (3)
Underscore needed years ago, not any more.
Your feedbacks and discussions are highly welcomed๐
take a look at Lodash