a weird set of little Javascript helpers we use for both nodeJS and browsers