A template for creating immutable objects in JS