diff options
author | Chocobozzz <me@florianbigard.com> | 2021-07-29 10:27:24 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2021-07-29 10:27:24 +0200 |
commit | b033851fb54241bb703f86add025229e68cc6f59 (patch) | |
tree | d60dac1499a95bf9dc902dee24f325fe0f8b6acb /shared/core-utils | |
parent | fbd67e7f386504e50f2504cb6386700a58906f16 (diff) | |
download | PeerTube-b033851fb54241bb703f86add025229e68cc6f59.tar.gz PeerTube-b033851fb54241bb703f86add025229e68cc6f59.tar.zst PeerTube-b033851fb54241bb703f86add025229e68cc6f59.zip |
Search channels against handles and not names
Diffstat (limited to 'shared/core-utils')
-rw-r--r-- | shared/core-utils/index.ts | 1 | ||||
-rw-r--r-- | shared/core-utils/utils/index.ts | 1 | ||||
-rw-r--r-- | shared/core-utils/utils/object.ts | 15 |
3 files changed, 17 insertions, 0 deletions
diff --git a/shared/core-utils/index.ts b/shared/core-utils/index.ts index 66d50ef93..2a7d4d982 100644 --- a/shared/core-utils/index.ts +++ b/shared/core-utils/index.ts | |||
@@ -4,3 +4,4 @@ export * from './i18n' | |||
4 | export * from './plugins' | 4 | export * from './plugins' |
5 | export * from './renderer' | 5 | export * from './renderer' |
6 | export * from './users' | 6 | export * from './users' |
7 | export * from './utils' | ||
diff --git a/shared/core-utils/utils/index.ts b/shared/core-utils/utils/index.ts new file mode 100644 index 000000000..a71977d88 --- /dev/null +++ b/shared/core-utils/utils/index.ts | |||
@@ -0,0 +1 @@ | |||
export * from './object' | |||
diff --git a/shared/core-utils/utils/object.ts b/shared/core-utils/utils/object.ts new file mode 100644 index 000000000..7b2bb81d0 --- /dev/null +++ b/shared/core-utils/utils/object.ts | |||
@@ -0,0 +1,15 @@ | |||
1 | function pick <T extends object> (object: T, keys: (keyof T)[]) { | ||
2 | const result: Partial<T> = {} | ||
3 | |||
4 | for (const key of keys) { | ||
5 | if (Object.prototype.hasOwnProperty.call(object, key)) { | ||
6 | result[key] = object[key] | ||
7 | } | ||
8 | } | ||
9 | |||
10 | return result | ||
11 | } | ||
12 | |||
13 | export { | ||
14 | pick | ||
15 | } | ||