UNPKG

linguist-js

Version:

Analyse the programming languages used in a folder or from raw content, using the same rules that GitHub Linguist does.

13 lines (12 loc) 439 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = parseGitignore; function parseGitignore(content) { const readableData = content // Remove comments unless escaped .replace(/(?<!\\)#.+/g, '') // Remove whitespace unless escaped .replace(/(?:(?<!\\)\s)+$/g, ''); const arrayData = readableData.split(/\r?\n/).filter(data => data); return arrayData; }