Factored out minsafeness in javascript