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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@jarenjs/formats

v0.9.2

Published

Jaren Formats for JSON Schema Validation

Downloads

180

Readme

@jarenjs/formats

Format validators for the JSON Schema format keyword, built on the text validators of @jarenjs/core. Includes all standard string formats (date-time, date, time, duration, email, idn-email, hostname, idn-hostname, ipv4, ipv6, uri, uri-reference, uri-template, iri, iri-reference, uuid, regex) plus many extras (isbn10, mac, base64, alpha, color, ...) and numeric formats (int8 ... uint64, float16 ... float64).

The JSON addressing formats are grouped separately in jsonFormats: json-pointer, json-pointer-uri-fragment and relative-json-pointer (RFC 6901), and json-path, which validates query strings against the complete RFC 9535 grammar using the parser of the JSONPath compiler in @jarenjs/json.

The name → predicate bindings live in one canonical table, exported as formatTesters (plus the per-group stringFormatTesters, jsonFormatTesters, dateTimeFormatTesters, numberFormatTesters): bare synchronous predicates without validator coupling. The format compilers above wrap these testers in the validator contract, and @jarenjs/forms merges its rendering hints over the same table for per-keystroke field validation — one registry, so the two layers can never drift apart.

Usage

import { JarenValidator } from '@jarenjs/validate';
import * as formats from '@jarenjs/formats';

const jaren = new JarenValidator()
  .addFormats(formats.stringFormats)
  .addFormats(formats.numberFormats)
  .addFormats(formats.dateTimeFormats)
  .addFormats(formats.jsonFormats);

const validate = jaren.compile({ type: 'string', format: 'json-path' });
validate('$.store.book[[email protected] < 10]'); // true

Format assertion follows the specification per draft: asserted through draft 2019-09, annotation-only from draft 2020-12 on unless enabled via the formatAssertion option (new JarenValidator({ formatAssertion: true })) or a metaschema that declares the format-assertion vocabulary.

✍ The complete format list

✍ Formats for strings

These format validators are based on the json-schema.org website. They are grouped in stringFormats (with the date/time formats also available separately as dateTimeFormats).

🗨 Formats for datetime

  • date-time | according to RFC3339, time-zone is mandatory

  • date | according to RFC3339, time-zone is mandatory

  • time | according to RFC3339, time-zone is mandatory

  • duration | duration from RFC3339

  • iso-date-time | ISO 8601 date-time with optional timezone

  • iso-time | ISO 8601 time with optional timezone

Note: All date time formats can use formatMinimum / formatMaximum and formatExclusiveMinimum and formatExclusiveMaximum

🗨 Formats for url's, hostnames and emails

  • url | full URL

  • url--full | same as url, but more comprehensive

  • uri | full URI

  • uri--full | same as uri, but more comprehensive

  • uri-reference | URI reference, including full and relative URIs

  • uri-reference--full | same as uri-reference, but more comprehensive

  • uri-template | URI template according to RFC6570

  • iri | full URI with international characters

  • iri-reference | full URI reference with with international characters

  • email | email address

  • email--full | same as email, but more comprehensive

  • hostname | host name according to RFC1034

  • idn-hostname | host name with international characters

  • idn-email | email address with international characters

🗨 Formats for identifiers

  • uuid | Universally Unique IDentifier according to RFC4122

  • guid | Globally Unique IDentifier according to Microsoft

  • identifier | C-type identifier

  • html-identifier | html element id attribute identifier according to RFC7992

  • css-identifier | css class name identifier according to RFC7993

  • mac | ethernet interface identifier (EUI-48) according to IEEE820

  • ipv4 | IP v4 address according to RFC791

  • ipv6 | IP v6 address according to RFC2460

🗨 Formats for json pointers and paths

These are grouped in jsonFormats.

  • json-pointer | JSON-pointer according to RFC6901
  • json-pointer-uri-fragment | JSON-pointer fragment according to RFC6901
  • relative-json-pointer | relative JSON-pointer according to draft-luff-relative-json-pointer-00
  • json-path | JSONPath query according to RFC9535, checked against the complete grammar (including filter well-typedness) by the parser of the JSONPath compiler in @jarenjs/json

🗨 Miscellaneous formats

  • alpha | allow only ASCII alpha characters (a-zA-Z)

  • numeric | allow only numeric characters (0-9)

  • alphanumeric | allow only ASCII alpha numeric characters

  • hexadecimal | allow only hexadecimal characters (0-9a-fA-F)

  • uppercase | allow only upper case alpha characters

  • lowercase | allow only lower case alpha characters

  • color | web color hex string (starts with #, must be 3 or 6 hax characters)

  • regex | tests whether a string is a valid regular expression

  • base64 | base64 encoded data

  • byte | same as base64 format

  • isbn10 | International Standard Book Number 10 digit number

  • isbn13 | International Standard Book Number 13 digit number

  • country2 | Country code by alpha-2 according to ISO3166-1 !No tests exists!

  • iban | International Bank Account Number !No tests exists!

✍ Formats for numbers

These are grouped in numberFormats. Formats for numbers validate both numbers and strings as number types; combine them with the type keyword (e.g. { "type": "integer", "format": "int32" }) when only real number types should be allowed.

🗨 Formats integer numbers

  • int8 | signed 8 bit integer
  • uint8 | unsigned 8 bit integer
  • int16 | signed 16 bit integer
  • uint16 | unsigned 16 bit integer
  • int32 | signed 32 bit integer
  • uint32 | unsigned 32 integer
  • int64 | signed 64 integer
  • uint64 | unsigned 64 integer

🗨 Formats floating point numbers

  • float16 | 16 bit floating point number
  • float32 | 32 bit floating point number
  • float64 | 64 bit floating point number
  • float | 32 bit floating point number
  • double | 64 bit floating point number

Development

Unit tests live in test/formats/ at the repository root; test/formats/testers.test.js enforces that every compiler registry's key set equals its tester group's, so the validator layer and the bare-predicate layer can never drift. The predicates themselves are implemented and tested in @jarenjs/core. See the repository README for the monorepo picture and the ROADMAP for planned formats.