Added a default value for needle as an empty string to stop it returning undefined when no search had been made.