aboutsummaryrefslogtreecommitdiffhomepage
path: root/shared/core-utils
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-07-29 10:27:24 +0200
committerChocobozzz <me@florianbigard.com>2021-07-29 10:27:24 +0200
commitb033851fb54241bb703f86add025229e68cc6f59 (patch)
treed60dac1499a95bf9dc902dee24f325fe0f8b6acb /shared/core-utils
parentfbd67e7f386504e50f2504cb6386700a58906f16 (diff)
downloadPeerTube-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.ts1
-rw-r--r--shared/core-utils/utils/index.ts1
-rw-r--r--shared/core-utils/utils/object.ts15
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'
4export * from './plugins' 4export * from './plugins'
5export * from './renderer' 5export * from './renderer'
6export * from './users' 6export * from './users'
7export * 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 @@
1function 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
13export {
14 pick
15}