Javascript helpers to manipulate objects