-
Notifications
You must be signed in to change notification settings - Fork 96
/
index.js
30 lines (24 loc) · 599 Bytes
/
index.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
var path = require('path')
var data = require('./data')
var elements = data.reduce(function (obj, element) {
obj[element.name] = element
return obj
}, {})
var symbols = data.reduce(function (obj, element) {
obj[element.symbol] = element
return obj
}, {})
var numbers = data.reduce(function (obj, element) {
obj[element.atomicNumber] = element
return obj
}, {})
module.exports = {
jsonFile: path.join(__dirname, 'data.json'),
csvFile: path.join(__dirname, 'data.csv'),
all: function all () {
return data
},
elements: elements,
symbols: symbols,
numbers: numbers
}