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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@bootstrapp/types

v0.2.0

Published

Type validation and coercion library for model fields and component properties

Readme

@bootstrapp/types

Type validation and coercion library for model fields and component properties.

Installation

npm install @bootstrapp/types

Overview

The @bootstrapp/types library provides a runtime type system for JavaScript applications with two primary use cases:

  1. Component Properties - Define stable APIs for UI components with automatic type coercion from attributes
  2. Data Models - Describe schemas for data models with validation rules and relationships

Quick Start

Component Properties

import T from '@bootstrapp/types';

const properties = {
  count: T.number({ defaultValue: 0 }),
  label: T.string({ required: true }),
  enabled: T.boolean({ defaultValue: true })
};

// Validate a single property
const result = properties.count.validate("42");
// { valid: true, value: 42, error: null, details: null }

Data Models

import T from '@bootstrapp/types';

const UserSchema = {
  name: T.string({ required: true }),
  email: T.string({ format: 'email' }),
  age: T.number({ min: 18 }),
  posts: T.many('Post', 'author')
};

const [errors, validatedUser] = T.validateType(userData, {
  schema: UserSchema
});

if (!errors) {
  // User data is valid
  console.log(validatedUser);
}

Available Types

  • Primitives: string, number, boolean, array, object, date, datetime, any, function
  • Relationships: belongs, belongs_many, one, many

Common Options

  • defaultValue - Default value if input is undefined/null
  • required - Value cannot be undefined/null
  • min/max - Min/max values for numbers and dates
  • format - Format validation (e.g., 'email')
  • customValidator - Custom validation function

Documentation

For complete API documentation and advanced usage, see types.md.

Links

License

AGPL-3.0