Added check for empty object on context.empty as well as updated jsdoc for the function to reflect the added line and previously added lines.