Add toMiJ method and make format method take only one parameter

MiJWriter.format() should take only one argument, a record. Move
the actual JS object conversion into a separate toMiJ method, so
that one can call that directly and avoid the over head of JSON
serialization/deserialization.