Javascript type utilities