Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@glimmer/validator

Package Overview
Dependencies
Maintainers
12
Versions
143
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@glimmer/validator

Objects used to track values and their dirtiness in Glimmer

  • 0.65.4
  • old
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
287K
increased by10%
Maintainers
12
Weekly downloads
 
Created

What is @glimmer/validator?

@glimmer/validator is a package used in the Glimmer.js ecosystem to provide reactive state management and validation. It allows developers to create reactive properties and track changes to them, ensuring that the UI stays in sync with the underlying data model.

What are @glimmer/validator's main functionalities?

Tracking Changes

This feature allows you to track changes to properties. When a tracked property changes, any dependent properties or computations are automatically updated.

const { tracked } = require('@glimmer/validator');

class Person {
  @tracked firstName;
  @tracked lastName;

  constructor(firstName, lastName) {
    this.firstName = firstName;
    this.lastName = lastName;
  }

  get fullName() {
    return `${this.firstName} ${this.lastName}`;
  }
}

let person = new Person('John', 'Doe');
console.log(person.fullName); // John Doe
person.firstName = 'Jane';
console.log(person.fullName); // Jane Doe

Validation

This feature allows you to validate properties using custom logic. The `@validate` decorator can be used to create computed properties that validate the state of other properties.

const { tracked, validate } = require('@glimmer/validator');

class User {
  @tracked email;

  constructor(email) {
    this.email = email;
  }

  @validate
  get isValidEmail() {
    return /^[^@]+@[^@]+\.[^@]+$/.test(this.email);
  }
}

let user = new User('test@example.com');
console.log(user.isValidEmail); // true
user.email = 'invalid-email';
console.log(user.isValidEmail); // false

Other packages similar to @glimmer/validator

FAQs

Package last updated on 18 Oct 2021

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc