Readme

This val provides a utility function that tests whether a given string is a valid val unique name (like the ones automatically generated when creating a new val). It's based on info provided by @maxm in the discord.

1
2
3
4
5
6
7
import { animals, colors } from "npm:unique-names-generator";
export default (name: string) => {
const splitName = name.replace(/([A-Z])/g, " $1").toLowerCase().trim().split(" ");
return splitName.length === 2 && colors.includes(splitName[0])
&& animals.includes(splitName[1]);
};
Val Town is a social website to write and deploy JavaScript.
Build APIs and schedule functions from your browser.
Comments
Nobody has commented on this val yet: be the first!
July 3, 2024