Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
}
const noStartEndHyphen = (value) => {
return !startEndHyphenPattern.test(value)
}
const numberOrPercentage = (value) => {
return numberOrPercentagePattern.test(value)
}
const unique = key => withParams({ type: 'unique', key },
function (value, parentVm) {
const keys = ref(key, this, parentVm)
return !includes(keys, value)
}
)
const uniqueWorkerName = withParams({ type: 'uniqueWorkerName' },
function unique (value) {
return this.workers.filter(item => item.name === value).length === 1
}
)
const serviceAccountKey = withParams({ type: 'serviceAccountKey' },
function (value) {
try {
const key = JSON.parse(value)
if (key.project_id && alphaNumUnderscoreHyphen(key.project_id)) {
return true
}
} catch (err) { /* ignore error */ }
return false
}
)
}
const unique = key => withParams({ type: 'unique', key },
function (value, parentVm) {
const keys = ref(key, this, parentVm)
return !includes(keys, value)
}
)
const uniqueWorkerName = withParams({ type: 'uniqueWorkerName' },
function unique (value) {
return this.workers.filter(item => item.name === value).length === 1
}
)
const serviceAccountKey = withParams({ type: 'serviceAccountKey' },
function (value) {
try {
const key = JSON.parse(value)
if (key.project_id && alphaNumUnderscoreHyphen(key.project_id)) {
return true
}
} catch (err) { /* ignore error */ }
return false
}
)
const minVolumeSize = key => withParams({ type: 'minVolumeSize', key },
function (value) {
if (this.volumeInCloudProfile) {
return minValue(key)(parseSize(value))
}