Lets create a series of fields:
{ container.add(new Field("name", "text")); container.add(new Field("surname", "text")); container.add(new Field("something", "text")); }
But wait we can just collect all the actuall info and then have the data so the code 'is not repeating':
fields = [ { title: "name", type: "text" }, { title: "surname", type: "text" }, { title: "something", type: "text" }, ];
But wait we can use code so the data 'is not repeating':
fields = [ ...[ "name", "surname", "something" ] .map(i => ({ title: i , type: "text" })) ];
But wait we can use data so the code 'is not repeating':
fields = [ { titles: [ "name", "surname", "something" ], type: "text" }, { titles: [ "birth", "death" ], type: "date" }, ].flatMap(magic);
But if you really thing about it, and ignore any "non-programmers", who are those guys anyway, the first one is what actually what happens, and by definition has no limitations because it's actually the thing itself, like C. And then you add some sugar and you are also modern:
{ container.add( field.text("name"), field.text("surname"), field.text("something"), field.date("birth"), field.date("death").optional, ) }
done_