Repository
Current version released
5 years ago
Versions
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.3/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.3/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
trimEnds
Returns the given string with the characters trimmed on each side by the length given, which is default by 1.
Example usage:
import { trimEnds } from "https://deno.land/x/grutils@0.0.3/mods.ts";
console.log(trimEnds("!Hello!")) // logs Hello to the console.