This file is indexed.

/usr/lib/nodejs/stream-assert/index.js is in node-stream-assert 2.0.3-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
var assertStream = require('./assertStream.js');
var assert = {};

function equal(expected) {
	if (typeof expected !== 'function') {
		return function (data) {
			if (data !== expected) {
				throw new Error(expected + ' is not equal ' + data);
			}
		};
	}
	return expected;
}

var defaults = assert.defaults = {
	highWatermark: 16,
	objectMode: true
};

assert.all = function (assertion) {
	var i = 0;
	return assertStream(defaults, function (obj, enc, cb) {
		try {
			assertion(obj);
			i++;
			cb(null, obj);
		} catch (err) {
			this.assertion('Element on ' + i + ' position is not passing assertion: ' + err.message);
		}
	});
};

assert.any = function (assertion) {
	var matched = false;
	return assertStream(defaults, function (obj, enc, cb) {
		try {
			assertion(obj);
			matched = true;
		} catch (err) { }
		cb(null, obj);
	}, function (cb) {
		if (!matched) {
			return this.assertion('Nothing passing assertion');
		}
		cb();
	});
};

assert.end = function (done) {
	var stream = assertStream(defaults, function (obj, enc, cb) {
		cb();
	});
	stream.on('finish', done || function () {});
	stream.on('assertion', done || function () {});
	return stream;
};

assert.first = function (assertion) {
	return assert.nth(0, assertion);
};

assert.last = function (assertion) {
	var lastItem;
	return assertStream(defaults, function (obj, enc, cb) {
		cb(null, lastItem = obj);
	}, function (cb) {
		try {
			assertion(lastItem);
			cb();
		} catch (err) {
			this.assertion('Last element is not passing assertion: ' + err.message);
		}
	});
};

assert.length = function (expected) {
	var i = 0;
	return assertStream(defaults, function (obj, enc, cb) {
		i++;
		cb(null, obj);
	}, function (cb) {
		var assertion = equal(expected);

		try {
			assertion(i);
			cb();
		} catch (err) {
			this.assertion('Expected length ' + err.message);
		}
	});
};

assert.nth = function (n, assertion) {
	var i = 0;
	return assertStream(defaults, function (obj, enc, cb) {
		if (i === n) {
			try {
				assertion(obj);
				i++;
				cb(null, obj);
			} catch (err) {
				this.assertion(n + ' position is not passing assertion: ' + err.message);
			}
		} else {
			i++;
			cb(null, obj);
		}
	});
};

assert.second = function (assertion) {
	return assert.nth(1, assertion);
};

module.exports = assert;