node_modules/JSONStream/test/destroy_missing.js

Maintainability

78.90

Lines of code

27

Created with Raphaël 2.1.002550751002015-1-52014-12-42014-12-3

2015-5-18
Maintainability: 78.9

Created with Raphaël 2.1.007.51522.5302015-1-52014-12-42014-12-3

2015-5-18
Lines of Code: 27

Difficulty

10.41

Estimated Errors

0.25

Function weight

By Complexity

Created with Raphaël 2.1.0<anonymous>2

By SLOC

Created with Raphaël 2.1.0<anonymous>14
1
var fs = require ('fs');
2
var net = require('net');
3
var join = require('path').join;
4
var file = join(__dirname, 'fixtures','all_npm.json');
5
var JSONStream = require('../');
6
 
7
 
8
var server = net.createServer(function(client) {
9
    var parser = JSONStream.parse([]);
10
    parser.on('end', function() {
11
        console.log('close')
Column: 29 "Missing semicolon."
12
        console.error('PASSED');
13
        server.close();
14
    });
15
    client.pipe(parser);
16
    var n = 4
Column: 14 "Missing semicolon."
17
    client.on('data', function () {
18
      if(--n) return
Column: 21 "Missing semicolon."
19
      client.end();
20
    })
Column: 7 "Missing semicolon."
21
});
22
server.listen(9999);
23
 
24
 
25
var client = net.connect({ port : 9999 }, function() {
26
    fs.createReadStream(file).pipe(client).on('data', console.log) //.resume();
Column: 67 "Missing semicolon."
27
});