diff --git a/frontend/common/utils/utils.tsx b/frontend/common/utils/utils.tsx index 88389946f1a4..a4413975a6be 100644 --- a/frontend/common/utils/utils.tsx +++ b/frontend/common/utils/utils.tsx @@ -212,10 +212,10 @@ const Utils = Object.assign({}, require('./base/_utils'), { ) { const findAppended = `${value}`.includes(':') ? (conditions || []).find((v) => { - const split = value.split(':') - const targetKey = `:${split[split.length - 1]}` - return v.value === operator + targetKey - }) + const split = value.split(':') + const targetKey = `:${split[split.length - 1]}` + return v.value === operator + targetKey + }) : false if (findAppended) return findAppended @@ -228,7 +228,7 @@ const Utils = Object.assign({}, require('./base/_utils'), { return Object.prototype.hasOwnProperty.call(flagsmith.getAllFlags(), flag) }, getContentType(contentTypes: ContentType[], model: string, type: string) { - return contentTypes.find((c: ContentType) => c[model] === type) || null + return contentTypes?.find((c: ContentType) => c[model] === type) || null }, getCreateProjectPermission(organisation: Organisation) { if (organisation?.restrict_project_create_to_admin) { @@ -248,9 +248,9 @@ const Utils = Object.assign({}, require('./base/_utils'), { waitFor: string | undefined, ): | { - amountOfTime: number - timeUnit: (typeof TimeUnit)[keyof typeof TimeUnit] - } + amountOfTime: number + timeUnit: (typeof TimeUnit)[keyof typeof TimeUnit] + } | undefined => { if (!waitFor) { return @@ -670,7 +670,7 @@ const Utils = Object.assign({}, require('./base/_utils'), { }, loadScriptPromise(url: string) { return new Promise((resolve) => { - const cb = function () { + const cb = function() { // @ts-ignore this.removeEventListener('load', cb) resolve(null)