Rather than duplicating code, perhaps it would be better to modify Ray.js instead:

    Ray.distanceToPoint( point, optionalIntersectionPoint )