pseudo-fork of traits.js