mirror of
https://github.com/iptv-org/epg.git
synced 2025-05-09 16:40:07 -04:00
Update file.js
This commit is contained in:
parent
e9d38de24c
commit
04bbec5e90
1 changed files with 3 additions and 2 deletions
|
@ -1,16 +1,17 @@
|
|||
const glob = require('glob')
|
||||
const fs = require('fs')
|
||||
const path = require('path')
|
||||
const wcmatch = require('wildcard-match')
|
||||
|
||||
function list(pattern, include = [], exclude = []) {
|
||||
return new Promise(resolve => {
|
||||
glob(pattern, function (err, files) {
|
||||
if (include.length) {
|
||||
files = files.filter(filename => include.includes(filename))
|
||||
files = files.filter(filename => include.some(item => wcmatch(item)(filename)))
|
||||
}
|
||||
|
||||
if (exclude.length) {
|
||||
files = files.filter(filename => !exclude.includes(filename))
|
||||
files = files.filter(filename => !exclude.some(item => wcmatch(item)(filename)))
|
||||
}
|
||||
|
||||
resolve(files)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue