Next-routes: Performance: use .some() instead of .reduce()?

Created on 5 Feb 2018  路  1Comment  路  Source: fridays/next-routes

I don't think that we need to loop through all the registered routes:
https://github.com/fridays/next-routes/blob/193f2a38605b03895f6bf9c23c65f72c0338d5c8/src/index.js#L51

Most helpful comment

You're right we could return earlier when a route was found. We used .find in the past but people had problems in IE. Maybe a for loop with early return would be best

>All comments

You're right we could return earlier when a route was found. We used .find in the past but people had problems in IE. Maybe a for loop with early return would be best

Was this page helpful?
0 / 5 - 0 ratings

Related issues

apapacy picture apapacy  路  4Comments

luisatmaniak picture luisatmaniak  路  6Comments

JiiB picture JiiB  路  4Comments

ccuilla picture ccuilla  路  6Comments

adrianha picture adrianha  路  3Comments