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

module.js ➔ getManifest   A

Complexity

Conditions 1
Paths 4

Size

Total Lines 14

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
c 1
b 0
f 0
nc 4
nop 1
dl 0
loc 14
rs 9.4285

1 Function

Rating   Name   Duplication   Size   Complexity  
B module.js ➔ ... ➔ jsonfile.readFile(ꞌmodule.jsonꞌ) 0 12 6
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