lib/gen.js
function parseIgnoreFile(ignoreFile) {
    // At first we'll try to determine line endings for ignore file.
    // For this we will count \n and \r\n occurrences and choose the one
    // which dominates. If we don't have line endings at all we will keep
    // default OS line endings.
    var lfCount = countOccurrences('\n', ignoreFile.content),
        crlfCount = countOccurrences('\r\n', ignoreFile.content);

    if (lfCount > 0 || crlfCount > 0)
        ignoreFile.eol = lfCount > crlfCount ? '\n' : '\r\n';


    ignoreFile.patterns = ignoreFile.content

        // Normalize new lines
        .replace(/\r\n?/g, '\n')

        // Then split content by new line
        .split('\n')

        // Trim items
        .map(function (str) {
            return str.trim();
        })

        // Skip empty strings and comments
        .filter(function (str) {
            return str && str.indexOf('#') !== 0;
        });
}
function parseIgnoreFile(ignoreFile) {
    // At first we'll try to determine line endings for ignore file.
    // For this we will count \n and \r\n occurrences and choose the one
    // which dominates. If we don't have line endings at all we will keep
    // default OS line endings.
    var lfCount = countOccurrences('\n', ignoreFile.content),
        crlfCount = countOccurrences('\r\n', ignoreFile.content);

    if (lfCount > 0 || crlfCount > 0)
        ignoreFile.eol = lfCount > crlfCount ? '\n' : '\r\n';


    ignoreFile.patterns = ignoreFile.content

        // Normalize new lines
        .replace(/\r\n?/g, '\n')

        // Then split content by new line
        .split('\n')

        // Trim items
        .map(function (str) {
            return str.trim();
        })

        // Skip empty strings and comments
        .filter(function (str) {
            return str && str.indexOf('#') !== 0;
        });
}
function parseIgnoreFile ( ignoreFile ) { // At first we'll try to determine line endings for ignore file. // For this we will count \n and \r\n occurrences and choose the one // which dominates. If we don't have line endings at all we will keep // default OS line endings. var lfCount = countOccurrences ( '\n' , ignoreFile . content ) , crlfCount = countOccurrences ( '\r\n' , ignoreFile . content ) ; if ( lfCount > 0 || crlfCount > 0 ) ignoreFile . eol = lfCount > crlfCount ? '\n' : '\r\n' ; ignoreFile . patterns = ignoreFile . content // Normalize new lines . replace ( / \r\n? / g , '\n' ) // Then split content by new line . split ( '\n' ) // Trim items . map ( function ( str ) { return str . trim ( ) ; } ) // Skip empty strings and comments . filter ( function ( str ) { return str && str . indexOf ( '#' ) !== 0 ; } ) ; }
Extract .npmignore file patterns
Extract . npmignore file patterns