Allow typed arrays to be passed in as data

Instead of calling slice and sort on the data object, use
Array.prototype.{slice,sort}.call, so it'll work on Array-likes.
Specifically typed arrays.
add karma conf file and requirejs-enabled test-main.js
add beginnings of a test suite; refactor a few things
add another large set of unit tests
remove side effect of dynamic palettes munging boxes array