Utility functions for handling JS objects