Skip to content

Commit 10c6ac4

Browse files
ovindu-aghostdevv
andauthored
feat: add jsdoc descriptions to the helpers (#149)
Co-authored-by: Willow (GHOST) <ghostdevbusiness@gmail.com>
1 parent 93a812d commit 10c6ac4

File tree

3 files changed

+43
-0
lines changed

3 files changed

+43
-0
lines changed

.changeset/young-news-fold.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"svelte-cloudinary": minor
3+
---
4+
5+
feat: add jsdoc descriptions to the helpers

packages/svelte-cloudinary/src/helpers/getCldImageUrl.ts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,26 @@ import {
66
type ImageOptions,
77
} from '@cloudinary-util/url-loader';
88

9+
/**
10+
* This can be used to get a Cloudinary image URL outside the component.
11+
*
12+
* This helper provides a wide range of options for being able to easily optimize and transform images.
13+
*
14+
* @see https://svelte.cloudinary.dev/helpers/getcldimageurl/configuration
15+
*
16+
* @example
17+
* <script>
18+
* import { getCldImageUrl } from 'svelte-cloudinary';
19+
*
20+
* const url = getCldImageUrl({
21+
* src: 'samples/sea-turtle', // The public ID of the image in Cloudinary
22+
* height: 600, // The desired height of the image
23+
* width: 960, // The desired width of the image
24+
* });
25+
*
26+
* console.log(url); // This outputs Cloudinary URL
27+
* </script>
28+
*/
929
export function getCldImageUrl(
1030
options: ImageOptions,
1131
configOverride?: ConfigOptions,

packages/svelte-cloudinary/src/helpers/getCldOgImageUrl.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,24 @@ import type {
55
ImageOptions,
66
} from '@cloudinary-util/url-loader';
77

8+
/**
9+
* This can be used to get a Cloudinary Open Graph image URL outside the component. This helper
10+
* provides a wide range of options for being able to easily generate social card images and has
11+
* sensible defaults, such as a width and height.
12+
*
13+
* @see https://svelte.cloudinary.dev/helpers/getcldogimageurl/configuration
14+
*
15+
* @example
16+
* <script>
17+
* import { getCldOgImageUrl } from 'svelte-cloudinary';
18+
*
19+
* const url = getCldOgImageUrl({
20+
* src: 'samples/sea-turtle', // The public ID of the image in Cloudinary
21+
* });
22+
*
23+
* console.log(url); // Outputs the Cloudinary OG image URL with the specified src
24+
* </script>
25+
*/
826
export function getCldOgImageUrl(
927
options: ImageOptions,
1028
configOverride?: ConfigOptions,

0 commit comments

Comments
 (0)