Fix getIndexOf fallback, general assert module cleanup, refs #27

We had duplicate versions of the same helper functions and things were sort of scattered throughout `assert.js`. I cleaned this up, fixed #27, and added a test case.