diff options
author | Chocobozzz <me@florianbigard.com> | 2021-07-26 15:04:37 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2021-07-26 15:04:37 +0200 |
commit | 15a7eafb892441957ba7dd6fcbf556086fe5b2b3 (patch) | |
tree | 0786bd1a96c7d168a097ffcf5893737db2ab578e /shared/core-utils/common/promises.ts | |
parent | 9162fdd36300d2478f13d6ad346ec2c323f40faa (diff) | |
download | PeerTube-15a7eafb892441957ba7dd6fcbf556086fe5b2b3.tar.gz PeerTube-15a7eafb892441957ba7dd6fcbf556086fe5b2b3.tar.zst PeerTube-15a7eafb892441957ba7dd6fcbf556086fe5b2b3.zip |
Refactor video links builders
Diffstat (limited to 'shared/core-utils/common/promises.ts')
-rw-r--r-- | shared/core-utils/common/promises.ts | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/shared/core-utils/common/promises.ts b/shared/core-utils/common/promises.ts new file mode 100644 index 000000000..7ef9d60b6 --- /dev/null +++ b/shared/core-utils/common/promises.ts | |||
@@ -0,0 +1,12 @@ | |||
1 | function isPromise (value: any) { | ||
2 | return value && typeof value.then === 'function' | ||
3 | } | ||
4 | |||
5 | function isCatchable (value: any) { | ||
6 | return value && typeof value.catch === 'function' | ||
7 | } | ||
8 | |||
9 | export { | ||
10 | isPromise, | ||
11 | isCatchable | ||
12 | } | ||