From e016cc192deb72f01a25de1574a8f0d740eaa383 Mon Sep 17 00:00:00 2001 From: zirkelc Date: Thu, 17 Oct 2024 10:10:30 +0200 Subject: [PATCH] feat: export `isS3Reference` --- .changeset/fifty-panthers-melt.md | 5 +++++ packages/store-s3/src/utils.ts | 6 ++++++ 2 files changed, 11 insertions(+) create mode 100644 .changeset/fifty-panthers-melt.md diff --git a/.changeset/fifty-panthers-melt.md b/.changeset/fifty-panthers-melt.md new file mode 100644 index 0000000..2b2b22e --- /dev/null +++ b/.changeset/fifty-panthers-melt.md @@ -0,0 +1,5 @@ +--- +"middy-store-s3": patch +--- + +feat: export `isS3Reference` diff --git a/packages/store-s3/src/utils.ts b/packages/store-s3/src/utils.ts index 60e2ee7..f262e3e 100644 --- a/packages/store-s3/src/utils.ts +++ b/packages/store-s3/src/utils.ts @@ -35,6 +35,12 @@ export const isS3Object = (obj: unknown): obj is S3Object => { ); }; +export const isS3Reference = (reference: unknown): reference is S3Reference => { + return ( + isS3Object(reference) || isS3ObjectArn(reference) || isS3Url(reference) + ); +}; + export const parseS3Reference = (reference: unknown): S3Object => { if (isS3Object(reference)) return reference; if (isS3ObjectArn(reference)) return parseS3ObjectArn(reference);