X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=shared%2Fcore-utils%2Fcommon%2Fpromises.ts;fp=shared%2Fcore-utils%2Fcommon%2Fpromises.ts;h=7ef9d60b6a80948e0cbc5ebd4554961d547265c5;hb=15a7eafb892441957ba7dd6fcbf556086fe5b2b3;hp=0000000000000000000000000000000000000000;hpb=9162fdd36300d2478f13d6ad346ec2c323f40faa;p=github%2FChocobozzz%2FPeerTube.git 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 @@ +function isPromise (value: any) { + return value && typeof value.then === 'function' +} + +function isCatchable (value: any) { + return value && typeof value.catch === 'function' +} + +export { + isPromise, + isCatchable +}