27 lines
1000 B
JavaScript
27 lines
1000 B
JavaScript
import people from '../.vscode/helper/.638443643487798783/people.json' with { type: 'json' };
|
|
|
|
const pathA = 'L:/Git/AA/.vscode/helper/.638443643487798783/id-name.sql';
|
|
const pathB = 'L:/Git/AA/.vscode/helper/.638443643487798783/id-name.json';
|
|
|
|
let results = [];
|
|
let name = '';
|
|
let person = {};
|
|
let line = '';
|
|
let lines = [];
|
|
for (const property in people) {
|
|
person = people[property];
|
|
name = person.Name.Suffix == undefined || person.Name.Suffix.length === 0
|
|
? person.Name.ForwardSlashFull
|
|
: person.Name.ForwardSlashFull + ' ' + person.Name.Suffix;
|
|
line = `update Tags set name = '${name}' where name = '${person.Birth.Note}';`
|
|
lines.push(line);
|
|
line = `update TagProperties set value = '${name}' where value = '${person.Birth.Note}';`
|
|
lines.push(line);
|
|
results.push({ id: person.Birth.Note, name: name });
|
|
}
|
|
|
|
const text = lines.join('\n');
|
|
await Bun.write(pathA, text);
|
|
|
|
const json = JSON.stringify(results);
|
|
await Bun.write(pathB, json); |