@stsoftware/tags@1.0.13Built and signed on GitHub ActionsBuilt and signed on GitHub Actions
Built and signed on GitHub Actions
latest
stSoftwareAU/TagsTSWorks with
•JSR Score94%•This package works with Node.js, Deno, Bun, BrowsersIt is unknown whether this package works with Cloudflare Workers




Downloads70/wk
•Published8 months ago (1.0.13)
TypeScript tagging
Tags
A TypeScript utility library for managing tags in JSON objects. This library provides a simple and efficient way to add, remove, and manage tags in your TypeScript/JavaScript applications.
Features
- Add and remove tags from JSON objects
- Type-safe tag management with TypeScript interfaces
- Simple and intuitive API
- Built for Deno runtime
Installation
Since this is a Deno module, you can import it directly in your Deno project:
import { addTag, removeTag, type TagsInterface } from "@stsoftware/tags";
Usage
Basic Tag Operations
import { addTag, removeTag, type TagsInterface } from "@stsoftware/tags"; // Create a taggable object const taggable: TagsInterface = { tags: undefined }; // Add a tag addTag(taggable, "hello", "world"); // Get a tag value const value = getTag(taggable, "hello"); // Returns "world" // Remove a tag const removedValue = removeTag(taggable, "hello"); // Returns "world"
Working with Multiple Tags
import { addTags, type TagsInterface } from "@stsoftware/tags"; const taggable: TagsInterface = { tags: undefined }; // Add multiple tags at once addTags(taggable, [ { name: "category", value: "electronics" }, { name: "price", value: "99.99" }, ]);
API Reference
Interfaces
TagsInterface: Defines an entity that can have tagsTagInterface: Defines the structure of a tag
Functions
addTag(taggable: TagsInterface, name: string, value: string): string | nulladdTags(taggable: TagsInterface, tags: TagInterface[]): voidgetTag(taggable: TagsInterface, name: string): string | nullremoveTag(taggable: TagsInterface, name: string): string | null
Application
Tag all JSON files within a directory.
#!/bin/bash deno run --allow-read --allow-write \ jsr:@stsoftware/tags/App \ --directory=.creatures \ --tagList=ABC=XYZ,HELLO=World
License
This project is licensed under the MIT License - see the LICENSE file for details.
Built and signed on
GitHub Actions