LeadDyno/intercooler-js — pull request #23 by niv (2014-07-04 16:17:27+00:00)
Title: make isDependent(src,dest) overridable from user code

This makes the internal isDependent() overridable via ```Intercooler.isDependentFunction = func(src, dest) { return bool; }```.

The point of this is that some users might want more fine-grained control over how URLs are matched against each other.

By default, Intercooler considers ```/model/123``` to be a dep of ```/model/1```. This is a bit awkward, and might trigger multiple refreshes.

I'm using the attached patch to do this:

Intercooler.isDependentFunction (src, dest) ->
unless src && dest
return false

sa = src.split("/")
sd = dest.split("/")

sd.slice(0, sa.length).join("/") == sa.join("/")

which basically checks that the individual path elements are equal, and not just the start of the string.

Not sure if this is something you'd want to consider.