Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
@glimmer/validator
Advanced tools
@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.
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
MobX is a state management library that makes it simple to connect the reactive data of your application with the UI. It provides similar reactive state management capabilities as @glimmer/validator but is more widely used and has a larger community.
Vue.js is a progressive JavaScript framework for building user interfaces. It includes a reactivity system that is similar to @glimmer/validator's tracking and validation features. Vue's reactivity system is more integrated into the framework, providing a more comprehensive solution for building reactive applications.
Redux is a predictable state container for JavaScript apps. While it does not provide the same automatic reactivity as @glimmer/validator, it offers a robust way to manage application state and can be combined with libraries like React to achieve similar reactive behavior.
FAQs
Objects used to track values and their dirtiness in Glimmer
We found that @glimmer/validator demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 15 open source maintainers collaborating on the project.
Did you know?
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.
Security News
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.