support for flags in eventLineup edit
This commit is contained in:
@@ -150,7 +150,19 @@ exports.parsePositionLabel = (label) => {
|
||||
positionFlags: null
|
||||
}
|
||||
}
|
||||
const positionLabelWithoutFlags= label.replace(/(.*?)\s\[(.*?)\]/, "$1")
|
||||
const positionFlags = label.replace(/(.*?)\s\[(.*?)\]/, "$2")
|
||||
const pattern = /(?<pos>[A-Z0-9]+)(?:\s\[(?<flags>.[A-z,]+)\])?/g
|
||||
const {pos, flags} = pattern.exec(label)?.groups || {}
|
||||
const positionLabelWithoutFlags= pos
|
||||
const positionFlags = flags?.split(',').map(f=>f.trim()) || []
|
||||
return {positionLabelWithoutFlags, positionFlags}
|
||||
}
|
||||
}
|
||||
|
||||
exports.compilePositionLabel = (label, flags) => {
|
||||
if (flags == null || flags == '' || flags.lengh == 0) {
|
||||
return label
|
||||
}
|
||||
else {
|
||||
const flags_set = new Set(flags.split(',').map(s=>s.trim()))
|
||||
return `${label} [${Array.from(flags_set).sort().join(',')}]`
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user