-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.js
33 lines (24 loc) · 904 Bytes
/
index.js
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
const through = require('through2');
const stream = require('./stream');
const loader = require('./loader');
function blacklistStream( blacklist ){
// blacklist was explicitely provided
if( 'object' === typeof blacklist ){
// blacklist is empty, return a no-op passthrough stream
if( Object.keys( blacklist ).length === 0 ){
return through.obj();
}
// return a blacklist stream based off user supplied blacklist
return stream( blacklist );
}
// no blacklist was provided via function arguments
// attempt to load the blacklist data from the pelias config file
blacklist = loader();
// blacklist is empty, return a no-op passthrough stream
if( Object.keys( blacklist ).length === 0 ){
return through.obj();
}
// return a blacklist stream based off files specified in pelias-config
return stream( blacklist );
}
module.exports = blacklistStream;