facg3 / chemics

0 stars 1 forks source link

limit could be replaced with ret.length #12

Open ZooeyMiller opened 6 years ago

ZooeyMiller commented 6 years ago

in the /chemics route you are finding matches in your .json file, and breaking when you have 7 results.

You both push to the ret array and increment limit at the same time. You could replace limit with ret.length and have the same result with less variables/complexity.

I love :heart_eyes: that you're using break to stop yourselves from looping through extra elements unnecessarily though.

NouraldinS commented 6 years ago

Great idea! Wish that I'd thought of that then, thanks for the tip :heart:

yahyaHB commented 6 years ago

thnx we thought of using limit just to reduce the mount of results.