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

lib/module.js   A

Complexity

Total Complexity 7
Complexity/F 3.5

Size

Lines of Code 23
Function Count 2

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 0
c 1
b 0
f 0
nc 1
dl 0
loc 23
rs 10
wmc 7
mnd 1
bc 4
fnc 2
bpm 2
cpm 3.5
noi 0

1 Function

Rating   Name   Duplication   Size   Complexity  
A module.js ➔ getManifest 0 14 1
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