scanner typescript functionality and unit test