Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions frontend/common/utils/utils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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) {
Expand All @@ -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
Expand Down Expand Up @@ -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)
Expand Down