MCPcopy Index your code
hub / github.com/GitbookIO/gitbook / parseIgnore

Function parseIgnore

lib/parse/parseIgnore.js:27–49  ·  view source on GitHub ↗

Parse ignore files @param {Book} @return {Book}

(book)

Source from the content-addressed store, hash-verified

25 @return {Book}
26*/
27function parseIgnore(book) {
28 if (book.isLanguageBook()) {
29 return Promise.reject(new Error('Ignore files could be parsed for language books'));
30 }
31
32 var fs = book.getFS();
33 var ignore = book.getIgnore();
34
35 ignore = ignore.add(DEFAULT_IGNORES);
36
37 return Promise.serie(IGNORE_FILES, function(filename) {
38 return fs.readAsString(filename)
39 .then(function(content) {
40 ignore = ignore.add(content.toString().split(/\r?\n/));
41 }, function(err) {
42 return Promise();
43 });
44 })
45
46 .then(function() {
47 return book.setIgnore(ignore);
48 });
49}
50
51module.exports = parseIgnore;

Callers 1

getBookFunction · 0.85

Calls

no outgoing calls

Tested by 1

getBookFunction · 0.68