There's really only one condition here -- could this be
`if (!localURL || (index < [[object fsRoot] length])) {`
to avoid duplicating the logic inside?