-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdataWrangler.js
113 lines (104 loc) · 3.31 KB
/
dataWrangler.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
// const { inspect } = require('util');
const data1 = require('./data1');
const data2 = require('./data2');
const data3 = require('./data3');
function joinData() {
const data = data1.map((element, index) => {
const elementNew = { ...element, ...data2[index] };
elementNew.webAttributes = {
tablerowcol: elementNew.tablerowcol,
tablecolumncol: elementNew.tablecolumncol,
visible: elementNew.visible,
cpkHexColor: elementNew.cpkHexColor,
image: `${String(elementNew.atomicNumber).padStart(3, '0')}_${elementNew.name.toLowerCase()}.jpg`,
};
delete elementNew.tablerowcol;
delete elementNew.tablecolumncol;
delete elementNew.visible;
delete elementNew.cpkHexColor;
elementNew.basics = {
name: elementNew.name,
atomicNumber: elementNew.atomicNumber,
symbol: elementNew.symbol,
};
elementNew.painting = {
medium: element.medium,
diameter: `${element.diameter} ft.`,
done: JSON.stringify(element.done)
};
elementNew.groupings = {
// category: elementNew.category,
groupBlock: elementNew.groupBlock,
bondingType: elementNew.bondingType,
standardState: elementNew.standardState,
stateOfMatter: elementNew.stateOfMatter,
atomicMass: elementNew.atomicMass.toString(),
atomicWeight: elementNew.atomicWeight,
atomicWeightFull: elementNew.atomicWeightFull,
density: elementNew.density,
atomicRadius: elementNew.atomicRadius,
vanDelWaalsRadius: elementNew.vanDelWaalsRadius,
ionRadius: elementNew.ionRadius,
meltingPoint: elementNew.meltingPoint,
boilingPoint: elementNew.boilingPoint,
};
elementNew.arrangements = {
electronicShellArrangement: data3[index][5],
electronicConfigurationShort: elementNew.electronicConfiguration,
electronicConfigurationFull: data3[index][4],
oxidationStates: elementNew.oxidationStates,
ionizationEnergy: elementNew.ionizationEnergy,
electronAffinity: elementNew.electronAffinity,
electronegativity: elementNew.electronegativity,
group: elementNew.group,
period: elementNew.period,
block: elementNew.block,
};
elementNew.short = {
Mass: elementNew.atomicMass.toString(),
Melting: elementNew.meltingPoint,
Boiling: elementNew.boilingPoint,
Shell: data3[index][5],
Configuration: elementNew.electronicConfiguration,
Series: elementNew.groupBlock,
State: elementNew.standardState,
};
return elementNew;
});
return data;
}
joinData();
// {
// name: 'Oganesson',
// atomicNumber: 118,
// symbol: 'Og',
// category: 'Unknown',
// atomicWeight: '[294]',
// atomicWeightFull: '-',
// occurrence: 'Unknown',
// stateofmatter: 'Synthetic',
// group: 18,
// period: 7,
// block: 'p',
// tablerowcol: 7,
// tablecolumncol: 18,
// visible: true,
// atomicMass: [294],
// cpkHexColor: '',
// electronicConfiguration: '[Rn] 5f14 6d10 7s2 7p6',
// electronegativity: '',
// atomicRadius: '',
// ionRadius: '',
// vanDelWaalsRadius: '',
// ionizationEnergy: '',
// electronAffinity: '',
// oxidationStates: '',
// standardState: '',
// bondingType: '',
// meltingPoint: '',
// boilingPoint: '',
// density: '',
// groupBlock: 'noble gas',
// yearDiscovered: 2002,
// webAttributes: {}
// },