Powershell: fixed width data to CSV

This of course needs a spec to say how to map the fixed width data. Code

A basic test in Pester at the end of the script file, broken then fixed:

 

Json: great site for faking up test data

Great site here. First 2 show the template I wrote for my composer test data. Final one is the author’s show-it-all template.

Here I try to reduce the Json to the bare minimum (I just want the “composer” line). But I can’t get the 2 dates to work inside the function. Doubtless me. It will do for now.

[
 {
 'repeat(3,3)': {
 dateOfBirth: '{{moment(this.date(new Date(1684, 0, 1), new Date(1722, 0, 1))).format("L")}}',
 dateOfDeath: '{{moment(this.date(new Date(1722, 0, 2), new Date(1801, 0, 1))).format("L")}}', 
 composer: function (tags) {
 return tags.surname().toUpperCase() + ', ' + tags.firstName() + 
 ' (' + this.dateOfBirth + ' - ' + this.dateOfDeath + ') ' ;
 }
 }
 }
]