aboutsummaryrefslogtreecommitdiffhomepage
path: root/shared/core-utils
diff options
context:
space:
mode:
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}