New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

@bootstrapp/types

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@bootstrapp/types

Type validation and coercion library for model fields and component properties

latest
Source
npmnpm
Version
0.2.0
Version published
Maintainers
1
Created
Source

@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:

  • Component Properties - Define stable APIs for UI components with automatic type coercion from attributes
  • 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.

License

AGPL-3.0

Keywords

types

FAQs

Package last updated on 30 Nov 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts