Skip to main content
Deno 2 is finally here 🎉️
Learn more

g-utils

A bunch of utility functions and other such things.

Usage

You can either import each individual function from their specific file, like so:

import randomElem from "https://deno.land/x/grutils@0.0.2/randomElem.ts"; // the function is a default export so you can call it whatever you want.

console.log(randomElem([1, 2, 3, 4, 5]));

or just import individual function from the mod.ts file, like so:

import { randomElem } from "https://deno.land/x/grutils@0.0.2/mod.ts"; // randomElem is not a default export in this case.

console.log(randomElem([1, 2, 3, 4, 5]));

Available utilities

All the utilities available from this library.

randomElem

Returns a random element from the array given.

inArr

Returns true if the element given is part of the array given, else returns false