Completed
Push — master ( 55b531...a54cab )
by Thomas
01:26 queued 01:08
created

module.js ➔ ... ➔ jsonfile.readFile(ꞌmodule.jsonꞌ)   B

Complexity

Conditions 6
Paths 3

Size

Total Lines 12

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 6
c 1
b 0
f 0
nc 3
nop 2
dl 0
loc 12
rs 8.8571
1
'use strict'
2
3
const jsonfile = require('jsonfile')
4
const output = require('./output')
5
6
function getManifest (callback) {
7
  jsonfile.readFile('module.json', function (err, module) {
8
    if (err) {
9
      output.err('Error reading module.json: ' + err)
10
      return
11
    }
12
    if (!('slug' in module) || !module.slug || typeof module.slug !== 'string' || !module.slug.length) {
13
      output.err('Please set a valid value for module.slug')
14
      return
15
    }
16
17
    callback(module)
18
  })
19
}
20
21
module.exports = {
22
  getManifest: getManifest
23
}
24