Indexer accepts js objects as well

This changes enables seamless integration as a node module, since
indexer now accepts data in a form of js object.