Add js checks in multiple files if data is undefined

Signed-off-by: Atul Pratap Singh <atulpratapsingh05@gmail.com>