npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

super-simple-validation

v1.0.8

Published

A super simple library for validating data

Downloads

2

Readme

Installation

$ npm install --save super-simple-validation

or if you prefer yarn

$ yarn add super-simple-validation

Usage

import { isEmail } from "super-simple-validation";

console.log(isEmail("[email protected]")); // true

API

is-email

Validates if the given string is an email address.

const valid = isEmail("[email protected]");

console.log(valid); // true

is-url

Validates if the given string is a URL.

const valid = isUrl("https://example.com");

console.log(valid); // true

is-phone

Validates if the given string is a phone number.

const valid = isPhone("+8612345678901");

console.log(valid); // true

is-hex-color

Validates if the given string is a hex color.

const valid = isHexColor("#ffffff");

console.log(valid); // true

is-css-color

Validates if the given string is a CSS color.

const valid =
  isCssColor("rgb(255, 255, 255)") &&
  isCssColor("rgba(255, 255, 255, 1)") &&
  isCssColor("hsl(0, 0%, 100%)") &&
  isCssColor("hsla(0, 0%, 100%, 1)") &&
  isCssColor("hwb(0, 0%, 0%)") &&
  isCssColor("blue") &&
  isCssColor("transparent");

console.log(valid); // true

is-discord-id

Validates if the given string is a Discord ID.

const valid = isDiscordId("973608903801708634");

console.log(valid); // true

is-date-time

Validates if the given string is a date time.

const valid = isDateTime("2021-10-01T00:00:00.000Z");

console.log(valid); // true

is-cc-number

Validates if the given string is a credit card number.

Strings with spaces and dashes are also supported.

Use true in second parameter to validate the the number with the Luhn algorithm. (More info: https://en.wikipedia.org/wiki/Luhn_algorithm)

const valid = isCcNumber("4539 1488 0343 6467");

console.log(valid); // true

// Optionally use true in the second parameter to validate the Luhn algorithm
const validWithLuhn = isCcNumber("4539 1488 0343 6467", true);

console.log(validWithLuhn); // true

is-cc-exp

Validates if the given string is a credit card expiration date.

const valid = isCcExp("10/25");

console.log(valid); // true

is-cc-cvv

Validates if the given string is a credit card CVV.

const valid = isCcCvv("123");

console.log(valid); // true