node_modules/through/test/async.js

Maintainability

80.00

Lines of code

28

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

2015-5-18
Maintainability: 80

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

2015-5-18
Lines of Code: 28

Difficulty

6.82

Estimated Errors

0.24

Function weight

By Complexity

Created with Raphaël 2.1.0<anonymous>1

By SLOC

Created with Raphaël 2.1.0<anonymous>23
1
var from = require('from')
Column: 27 "Missing semicolon."
2
var through = require('../')
Column: 29 "Missing semicolon."
3
 
4
var tape = require('tape')
Column: 27 "Missing semicolon."
5
 
6
tape('simple async example', function (t) {
7
 
8
  var n = 0, expected = [1,2,3,4,5], actual = []
Column: 49 "Missing semicolon."
9
  from(expected)
10
  .pipe(through(function(data) {
11
    this.pause()
Column: 17 "Missing semicolon."
12
    n ++
Column: 9 "Missing semicolon."
13
    setTimeout(function(){
14
      console.log('pushing data', data)
Column: 40 "Missing semicolon."
15
      this.push(data)
Column: 22 "Missing semicolon."
16
      this.resume()
Column: 20 "Missing semicolon."
17
    }.bind(this), 300)
Column: 23 "Missing semicolon."
18
  })).pipe(through(function(data) {
19
    console.log('pushing data second time', data);
20
    this.push(data)
Column: 20 "Missing semicolon."
21
  })).on('data', function (d) {
22
    actual.push(d)
Column: 19 "Missing semicolon."
23
  }).on('end', function() {
24
    t.deepEqual(actual, expected)
Column: 34 "Missing semicolon."
25
    t.end()
Column: 12 "Missing semicolon."
26
  })
Column: 5 "Missing semicolon."
27
 
28
})
Column: 3 "Missing semicolon."