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

joi-contrib

v0.0.1

Published

joi-contrib contains a series of joi validation functions not available in joi core

Downloads

4

Readme

joi-contrib

joi-contrib contains a series of joi validation functions not available in joi core

build status

Contains validation for:

  • E.164 phone number
  • ObjectId
  • IP v4
  • IP v6
  • Image file extension
  • Video file extension
  • Audio file extension

Installation

npm install joi
npm install joi-contrib --save

Usage

var Joi = require('joi');
Joi.contrib = require('joi-contrib');

var schema = {
  something: Joi.contrib.*()
}

Tests

npm test

Api

E.164 number

validates that the value is a valid international phone number complying to E.164 numbering format

var Joi = require('joi');
Joi.contrib = require('joi-contrib');

var schema = {
  phone: Joi.contrib.e164()
}

ObjectId

validates that the value is an alphanumeric string of 24 characters in length, for example a mongo identifier.

var Joi = require('joi');
Joi.contrib = require('joi-contrib');

var schema = {
  id: Joi.contrib.objectId()
}

IP v4

validates that the value is an ip address ipv4

var Joi = require('joi');
Joi.contrib = require('joi-contrib');

var schema = {
  ip: Joi.contrib.ipv4()
}

IP v6

validates that the value is an ip address ipv6

var Joi = require('joi');
Joi.contrib = require('joi-contrib');

var schema = {
  ip: Joi.contrib.ipv6()
}

Image file extension

validates that the value is an image file

var Joi = require('joi');
Joi.contrib = require('joi-contrib');

var schema = {
  ext: Joi.contrib.imageFile()
}

Video file extension

validates that the value is an video file

var Joi = require('joi');
Joi.contrib = require('joi-contrib');

var schema = {
  ext: Joi.contrib.videoFile()
}

Audio file extension

validates that the value is an audio file

var Joi = require('joi');
Joi.contrib = require('joi-contrib');

var schema = {
  ext: Joi.contrib.audioFile()
}

Coming soon

  • validate url
  • validate string is html
  • validate hex color
  • validate domain name
  • validate mac address
  • validate credit card types, visa, mastercard, amex, diners, discover, jcb
  • validate isbn
  • validate uuid
  • validate gsmCharSet

License

MIT