mirror of
https://github.com/dorny/paths-filter.git
synced 2025-06-08 00:59:04 +00:00
Support reusable paths blocks via yaml anchors (#13)
* Add support for nested arrays of path expressions * Remove pull_request trigger type options Default value is fine: opened, synchronize, reopened * Add CHANGELOG * Update README
This commit is contained in:
parent
4eb15bc267
commit
7d201829e2
9 changed files with 301 additions and 91 deletions
10
dist/index.js
vendored
10
dist/index.js
vendored
|
@ -4654,10 +4654,11 @@ class Filter {
|
|||
dot: true
|
||||
};
|
||||
for (const name of Object.keys(doc)) {
|
||||
const patterns = doc[name];
|
||||
if (!Array.isArray(patterns)) {
|
||||
const patternsNode = doc[name];
|
||||
if (!Array.isArray(patternsNode)) {
|
||||
this.throwInvalidFormatError();
|
||||
}
|
||||
const patterns = flat(patternsNode);
|
||||
if (!patterns.every(x => typeof x === 'string')) {
|
||||
this.throwInvalidFormatError();
|
||||
}
|
||||
|
@ -4678,6 +4679,11 @@ class Filter {
|
|||
}
|
||||
}
|
||||
exports.default = Filter;
|
||||
// Creates a new array with all sub-array elements recursively concatenated
|
||||
// In future could be replaced by Array.prototype.flat (supported on Node.js 11+)
|
||||
function flat(arr) {
|
||||
return arr.reduce((acc, val) => acc.concat(Array.isArray(val) ? flat(val) : val), []);
|
||||
}
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue