Skip to content

Commit

Permalink
feat(npm): add Image.Tags
Browse files Browse the repository at this point in the history
  • Loading branch information
bounoable committed Sep 15, 2022
1 parent 0274abe commit bbb050f
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 2 deletions.
2 changes: 1 addition & 1 deletion packages/media-entity/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@modernice/media-entity",
"version": "v0.0.9",
"version": "v0.0.10",
"description": "media-entity types",
"main": "./dist/index.cjs",
"module": "./dist/index.mjs",
Expand Down
2 changes: 2 additions & 0 deletions packages/media-entity/src/image.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ export interface Image<Languages extends string = string> {
* Localized descriptions of the image.
*/
descriptions: { [lang in Languages]?: string }

tags: string[]
}

/**
Expand Down
2 changes: 1 addition & 1 deletion packages/media-entity/src/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export {}
export * from './tagging.js'
13 changes: 13 additions & 0 deletions packages/media-entity/src/tagging.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/**
* Anything that provides tags.
*/
export interface Taggable {
tags: string[]
}

/**
* Returns whether `v` has the given `tag`.
*/
export function hasTag(v: Taggable, tag: string) {
return v.tags.includes(tag)
}

0 comments on commit bbb050f

Please sign in to comment.