Passed
Push — master ( 8031f2...0549a3 )
by Andrii
02:44
created

__recipes__/js-api/index.js   A

Complexity

Total Complexity 3
Complexity/F 1.5

Size

Lines of Code 20
Function Count 2

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
wmc 3
eloc 16
mnd 1
bc 1
fnc 2
dl 0
loc 20
rs 10
bpm 0.5
cpm 1.5
noi 4
c 0
b 0
f 0
1
const dts = require('postcss-d-ts')
2
const postcss = require('postcss')
3
const fs = require('fs')
4
5
fs.readFile('index.css', (_, css) => {
6
  try {
7
    postcss([
8
      dts(),
9
    ], { from: 'index.css', to: 'out.css' })
10
      .process(css)
11
      .then(result => {
12
        console.log(result.css);
0 ignored issues
show
Debugging Code introduced by
console.log looks like debug code. Are you sure you do not want to remove it?
Loading history...
13
        process.exit(1);
0 ignored issues
show
Compatibility Debugging Code Best Practice introduced by
Use of process.exit() is discouraged as it will potentially stop the complete node.js application. Consider quitting gracefully instead by throwing an Error.
Loading history...
14
      })
15
  } catch(e) {
16
    process.exit(0)
0 ignored issues
show
Compatibility Debugging Code Best Practice introduced by
Use of process.exit() is discouraged as it will potentially stop the complete node.js application. Consider quitting gracefully instead by throwing an Error.
Loading history...
17
  } finally {
18
    process.exit(1)
0 ignored issues
show
Compatibility Debugging Code Best Practice introduced by
Use of process.exit() is discouraged as it will potentially stop the complete node.js application. Consider quitting gracefully instead by throwing an Error.
Loading history...
19
  }
20
})
21