
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
One straight forward function that returns a random item
from an array 😍
npm i @ssts/item
import seniorITEM from "@ssts/item";
const randomItem = seniorITEM(["Item 1", "Item 2", "Item 3"]);
Returns a random item from an array
Order | Parameter | Type | Default |
---|---|---|---|
1 | array | any[] | required |
import seniorITEM from "@ssts/item";
const snacks = ["Peanuts", "Chips", "Candy", "Chocolate", "Popcorn", "Cookies", "Donuts", "Ice cream", "Yogurt", "Brownies", "Cupcakes", "Gummies", "Muffins", "Your favorite drink lol"] as const;
const randomSnack = seniorITEM(snacks);
console.log(randomSnack); // 'Chips'
type Snacks = typeof snacks;
// It's okay With/Without a generic
console.log(seniorITEM(snacks)); // 'Cookies'
console.log(seniorITEM<Snacks>(snacks)); // 'Candy'
type Item = {
key: string;
name: string;
imgSrc: string;
};
type Items = Item[];
const items: Items = [/* ... */];
console.log(seniorITEM(items)); // { key: "17", name: "Item 17", imgSrc: "https://picsum.photos/200" }
console.log(seniorITEM<Items>(items)); // { key: "5", name: "Item 5", imgSrc: "https://picsum.photos/200" }
Made With Chocolate By Senior Sedo 😎
Be Chocolateful 💙😍
ssts stands for senior-sedo-typescript 💙
So instead of
@senior-sedo-typescript/rand-item
@ssts/item
for simplicity sake 😍
FAQs
Get a random item from an array.
The npm package @ssts/item receives a total of 1 weekly downloads. As such, @ssts/item popularity was classified as not popular.
We found that @ssts/item demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.