picture

Picture.js

GitHub Repo GitHub Repo

Picture is a small-but-powerful JavaScript class for formatting, deformatting, and validating data using picture strings — compact format descriptors for strings, numbers, dates, times, and patterns.

You can try a live sample here

and here

Overview

Picture is a static-only JavaScript class. All methods are called directly on the class — no instantiation needed. It provides three core capabilities:

  1. Formatting — Transform raw data into display-ready strings.
  2. Deformatting — Extract raw data back from formatted strings.
  3. Validation — Check whether a value matches the constraints defined by a picture string.

Additionally, Picture can bind directly to DOM <input> elements, providing real-time keystroke validation, formatting on blur, and deformatting on focus.


You can view all documentation on picture.md

You can get more powerful toys on…