diff options
author | Chocobozzz <me@florianbigard.com> | 2022-08-17 15:36:03 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2022-08-17 15:36:03 +0200 |
commit | 690bb8f9f3413147a4f71d5ff0a3cd8170a94ce3 (patch) | |
tree | b16b8536acd2098aba8c1d6fe13a336dd6aa01a9 /client/src/app | |
parent | bbd5aa7ead5f1554a0872963f957effc26d8c630 (diff) | |
download | PeerTube-690bb8f9f3413147a4f71d5ff0a3cd8170a94ce3.tar.gz PeerTube-690bb8f9f3413147a4f71d5ff0a3cd8170a94ce3.tar.zst PeerTube-690bb8f9f3413147a4f71d5ff0a3cd8170a94ce3.zip |
Prefer using Object.values
Diffstat (limited to 'client/src/app')
3 files changed, 11 insertions, 11 deletions
diff --git a/client/src/app/helpers/utils/object.ts b/client/src/app/helpers/utils/object.ts index 1ca4a23ac..69b2b18c0 100644 --- a/client/src/app/helpers/utils/object.ts +++ b/client/src/app/helpers/utils/object.ts | |||
@@ -18,7 +18,7 @@ function sortBy (obj: any[], key1: string, key2?: string) { | |||
18 | }) | 18 | }) |
19 | } | 19 | } |
20 | 20 | ||
21 | function intoArray (value: any) { | 21 | function splitIntoArray (value: any) { |
22 | if (!value) return undefined | 22 | if (!value) return undefined |
23 | if (Array.isArray(value)) return value | 23 | if (Array.isArray(value)) return value |
24 | 24 | ||
@@ -42,6 +42,6 @@ export { | |||
42 | sortBy, | 42 | sortBy, |
43 | immutableAssign, | 43 | immutableAssign, |
44 | removeElementFromArray, | 44 | removeElementFromArray, |
45 | intoArray, | 45 | splitIntoArray, |
46 | toBoolean | 46 | toBoolean |
47 | } | 47 | } |
diff --git a/client/src/app/shared/shared-search/advanced-search.model.ts b/client/src/app/shared/shared-search/advanced-search.model.ts index ea9baa27f..e8bb00fd3 100644 --- a/client/src/app/shared/shared-search/advanced-search.model.ts +++ b/client/src/app/shared/shared-search/advanced-search.model.ts | |||
@@ -1,4 +1,4 @@ | |||
1 | import { intoArray } from '@app/helpers' | 1 | import { splitIntoArray } from '@app/helpers' |
2 | import { | 2 | import { |
3 | BooleanBothQuery, | 3 | BooleanBothQuery, |
4 | BooleanQuery, | 4 | BooleanQuery, |
@@ -76,8 +76,8 @@ export class AdvancedSearch { | |||
76 | this.categoryOneOf = options.categoryOneOf || undefined | 76 | this.categoryOneOf = options.categoryOneOf || undefined |
77 | this.licenceOneOf = options.licenceOneOf || undefined | 77 | this.licenceOneOf = options.licenceOneOf || undefined |
78 | this.languageOneOf = options.languageOneOf || undefined | 78 | this.languageOneOf = options.languageOneOf || undefined |
79 | this.tagsOneOf = intoArray(options.tagsOneOf) | 79 | this.tagsOneOf = splitIntoArray(options.tagsOneOf) |
80 | this.tagsAllOf = intoArray(options.tagsAllOf) | 80 | this.tagsAllOf = splitIntoArray(options.tagsAllOf) |
81 | this.durationMin = options.durationMin ? parseInt(options.durationMin, 10) : undefined | 81 | this.durationMin = options.durationMin ? parseInt(options.durationMin, 10) : undefined |
82 | this.durationMax = options.durationMax ? parseInt(options.durationMax, 10) : undefined | 82 | this.durationMax = options.durationMax ? parseInt(options.durationMax, 10) : undefined |
83 | 83 | ||
@@ -152,9 +152,9 @@ export class AdvancedSearch { | |||
152 | originallyPublishedStartDate: this.originallyPublishedStartDate, | 152 | originallyPublishedStartDate: this.originallyPublishedStartDate, |
153 | originallyPublishedEndDate: this.originallyPublishedEndDate, | 153 | originallyPublishedEndDate: this.originallyPublishedEndDate, |
154 | nsfw: this.nsfw, | 154 | nsfw: this.nsfw, |
155 | categoryOneOf: intoArray(this.categoryOneOf), | 155 | categoryOneOf: splitIntoArray(this.categoryOneOf), |
156 | licenceOneOf: intoArray(this.licenceOneOf), | 156 | licenceOneOf: splitIntoArray(this.licenceOneOf), |
157 | languageOneOf: intoArray(this.languageOneOf), | 157 | languageOneOf: splitIntoArray(this.languageOneOf), |
158 | tagsOneOf: this.tagsOneOf, | 158 | tagsOneOf: this.tagsOneOf, |
159 | tagsAllOf: this.tagsAllOf, | 159 | tagsAllOf: this.tagsAllOf, |
160 | durationMin: this.durationMin, | 160 | durationMin: this.durationMin, |
diff --git a/client/src/app/shared/shared-video-miniature/video-filters.model.ts b/client/src/app/shared/shared-video-miniature/video-filters.model.ts index 8ad2fcd5d..73a30ca08 100644 --- a/client/src/app/shared/shared-video-miniature/video-filters.model.ts +++ b/client/src/app/shared/shared-video-miniature/video-filters.model.ts | |||
@@ -1,4 +1,4 @@ | |||
1 | import { intoArray, toBoolean } from '@app/helpers' | 1 | import { splitIntoArray, toBoolean } from '@app/helpers' |
2 | import { getAllPrivacies } from '@shared/core-utils' | 2 | import { getAllPrivacies } from '@shared/core-utils' |
3 | import { AttributesOnly } from '@shared/typescript-utils' | 3 | import { AttributesOnly } from '@shared/typescript-utils' |
4 | import { BooleanBothQuery, NSFWPolicyType, VideoInclude, VideoPrivacy, VideoSortField } from '@shared/models' | 4 | import { BooleanBothQuery, NSFWPolicyType, VideoInclude, VideoPrivacy, VideoSortField } from '@shared/models' |
@@ -94,8 +94,8 @@ export class VideoFilters { | |||
94 | 94 | ||
95 | if (obj.nsfw !== undefined) this.nsfw = obj.nsfw | 95 | if (obj.nsfw !== undefined) this.nsfw = obj.nsfw |
96 | 96 | ||
97 | if (obj.languageOneOf !== undefined) this.languageOneOf = intoArray(obj.languageOneOf) | 97 | if (obj.languageOneOf !== undefined) this.languageOneOf = splitIntoArray(obj.languageOneOf) |
98 | if (obj.categoryOneOf !== undefined) this.categoryOneOf = intoArray(obj.categoryOneOf) | 98 | if (obj.categoryOneOf !== undefined) this.categoryOneOf = splitIntoArray(obj.categoryOneOf) |
99 | 99 | ||
100 | if (obj.scope !== undefined) this.scope = obj.scope | 100 | if (obj.scope !== undefined) this.scope = obj.scope |
101 | if (obj.allVideos !== undefined) this.allVideos = toBoolean(obj.allVideos) | 101 | if (obj.allVideos !== undefined) this.allVideos = toBoolean(obj.allVideos) |