Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function walk(value, path) {
let curr = path[path.length - 1]
if(value === null) {
return null
}
///// Restricted $refs
if(curr === "$ref") {
let refBlacklist = getRefPatternBlacklist(path) || []
let matches = match([value], refBlacklist)
let humanFriendlyRefBlacklist = refBlacklist
.map(val => `"${val}"`)
.join(", ")
if(refBlacklist && refBlacklist.length && matches.length) {
// Assertation 1
errors.push({
path,
message: `${path[path.length - 2]} $refs cannot match any of the following: ${humanFriendlyRefBlacklist}`
})
}
}
if(typeof value !== "object") {
return null
public static anyMatch(strings: string | string[], patterns: string | string[]): boolean {
const stringArray = ArrayUtil.toStringArray(strings);
const patternArray = ArrayUtil.toStringArray(patterns);
return Matcher(stringArray, patternArray).length !== 0;
}