Skip to content

Commit

Permalink
feat: add jsdoc descriptions to the helpers (#149)
Browse files Browse the repository at this point in the history
Co-authored-by: Willow (GHOST) <[email protected]>
  • Loading branch information
ovindu-a and ghostdevv authored Oct 2, 2024
1 parent 93a812d commit 10c6ac4
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/young-news-fold.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"svelte-cloudinary": minor
---

feat: add jsdoc descriptions to the helpers
20 changes: 20 additions & 0 deletions packages/svelte-cloudinary/src/helpers/getCldImageUrl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,26 @@ import {
type ImageOptions,
} from '@cloudinary-util/url-loader';

/**
* This can be used to get a Cloudinary image URL outside the component.
*
* This helper provides a wide range of options for being able to easily optimize and transform images.
*
* @see https://svelte.cloudinary.dev/helpers/getcldimageurl/configuration
*
* @example
* <script>
* import { getCldImageUrl } from 'svelte-cloudinary';
*
* const url = getCldImageUrl({
* src: 'samples/sea-turtle', // The public ID of the image in Cloudinary
* height: 600, // The desired height of the image
* width: 960, // The desired width of the image
* });
*
* console.log(url); // This outputs Cloudinary URL
* </script>
*/
export function getCldImageUrl(
options: ImageOptions,
configOverride?: ConfigOptions,
Expand Down
18 changes: 18 additions & 0 deletions packages/svelte-cloudinary/src/helpers/getCldOgImageUrl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,24 @@ import type {
ImageOptions,
} from '@cloudinary-util/url-loader';

/**
* This can be used to get a Cloudinary Open Graph image URL outside the component. This helper
* provides a wide range of options for being able to easily generate social card images and has
* sensible defaults, such as a width and height.
*
* @see https://svelte.cloudinary.dev/helpers/getcldogimageurl/configuration
*
* @example
* <script>
* import { getCldOgImageUrl } from 'svelte-cloudinary';
*
* const url = getCldOgImageUrl({
* src: 'samples/sea-turtle', // The public ID of the image in Cloudinary
* });
*
* console.log(url); // Outputs the Cloudinary OG image URL with the specified src
* </script>
*/
export function getCldOgImageUrl(
options: ImageOptions,
configOverride?: ConfigOptions,
Expand Down

0 comments on commit 10c6ac4

Please sign in to comment.