build_scripts/generate_resource_matrix.js   A
last analyzed

Complexity

Total Complexity 2
Complexity/F 0

Size

Lines of Code 20
Function Count 0

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
wmc 2
nc 3
mnd 2
bc 2
fnc 0
dl 0
loc 20
rs 10
bpm 0
cpm 0
noi 0
c 0
b 0
f 0
1
/* eslint-env node */
2
/*jslint node: true */
3
'use strict';
4
5
let jsonfile = require('jsonfile');
6
7
let elements = jsonfile.readFileSync('build/data/elements.json');
8
9
let matrix = {};
10
11
for (let i in elements) {
12
  let element = elements[i];
13
  matrix[element.number] = {};
14
  for(let isotope in element.isotopes){
15
    let number = parseInt(isotope, 10);
16
    matrix[element.number][number] = isotope;
17
  }
18
}
19
20
jsonfile.writeFileSync('build/data/resource_matrix.json', matrix, {
21
  spaces: 2
22
});
23