Closed leggsimon closed 7 years ago
Ohhh hang on, I think I know why I'm wrong here. This is so that a Map containing
['key1', 'value1'],
['key12', 'value12'],
['key123', 'value123'],
['key1234', 'value1234'],
['key12345', 'value12345']
if we used map.get('key12345')
we would get one result, whereas we currently would get all of those back since all the keys are included in 'key12345'
I can't remember writing this an looked through the commit history.
I lifted it from the sw Router and made it a shared util so it could be used for the msg router I wrote (which is basically a very stripped down version of the Router).
So I never looked a the code in too much detail. Another thing to note is that it is doing a regexp.test
to find a match aswell so that routes like /*
work or /^blah
.
@tavvy I'm just double checking incase I've overlooked something but this function
keyMatch
in this moduleDoesn't this just do the same as
or if it must return an array (which seems odd because it would only have one result), do this?