Factory for building Javascript objects.