
Security News
Axios Supply Chain Attack Reaches OpenAI macOS Signing Pipeline, Forces Certificate Rotation
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.
A TypeScript library for validating object typings and values with custom rules, offering both strict type checking and value validation.
A TypeScript library for validating object typings and values with custom rules, offering both strict type checking and value validation.
Install via npm:
npm install typix
Or using Yarn:
yarn add typix
Typix helps validate objects by checking their field types and values:
ID is not -1).strict property set to false, making them optional and skipping validation if the field is missing or undefined.import typix from "typix";
const options = {
fields: [
{ name: "ID", type: "number", validateValue: (value) => value !== -1 }, // Custom rule for ID
{ name: "NAME", type: "string" },
{ name: "AGE", type: "number" },
],
strict: true,
};
const testData = {
ID: 1,
NAME: "John Doe",
AGE: 30,
};
const result = await typix.validate(options, testData);
console.log(result.isValid); // true
console.log(result.message); // "Field validations were successful"
Typix checks if the ID is a number and not equal to -1.NAME as a string and AGE as a number.import typix from "typix";
const options = {
fields: [
{ name: "ID", type: "number", validateValue: (value) => value !== -1 },
{ name: "NAME", type: "string" },
{ name: "AGE", type: "number" },
],
strict: true,
};
const testData = {
ID: "1", // Invalid type for ID
NAME: "John Doe",
AGE: 30,
};
const result = await typix.validate(options, testData);
console.log(result.isValid); // false
console.log(result.message); // "One or more field validations failed"
console.log(result.expectedFields); // List of validation errors
ID is of the wrong type (e.g., a string instead of a number), the validation will fail.expectedType, receivedValue, and error type will be provided.import typix from "typix";
const options = {
fields: [
{ name: "ID", type: "number" },
{ name: "NAME", type: "string", strict: false }, // NAME is optional
{ name: "AGE", type: "number" },
],
strict: true,
};
const testData = {
ID: 1,
NAME: undefined, // Skipped due to strict: false
AGE: 24,
};
const result = await typix.validate(options, testData);
console.log(result.isValid); // true
console.log(result.message); // "Field validations were successful"
NAME field is optional because its strict property is false, so undefined is allowed.ID and AGE) are still validated as mandatory due to the global strict: true.import typix from "typix";
const options = {
fields: [
{ name: "ID", type: "number" },
{ name: "NAME", type: "string", strict: false },
{ name: "AGE", type: "number" },
],
strict: false, // No fields are mandatory
};
const testData = {
ID: undefined,
NAME: undefined,
AGE: undefined,
};
const result = await typix.validate(options, testData);
console.log(result.isValid); // true
console.log(result.message); // "Field validations were successful"
strict: false at the global level, no fields are mandatory, and missing or undefined fields are skipped.Strict Mode Validation:
strict: false is set on a field).ID !== -1.Flexible Validation:
strict: false on individual fields or globally.ID !== -1).✅ Strict validation mode ensures complete validation of object fields.
✅ Custom validation logic gives flexibility to handle complex field rules.
✅ Optional fields with strict: false allow for flexible validation scenarios.
✅ Safe for use in form validation, API response checks, and object integrity validation.
MIT License
FAQs
A TypeScript library for validating object typings and values with custom rules, offering both strict type checking and value validation.
The npm package typix receives a total of 11 weekly downloads. As such, typix popularity was classified as not popular.
We found that typix demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer 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
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.

Security News
Open source is under attack because of how much value it creates. It has been the foundation of every major software innovation for the last three decades. This is not the time to walk away from it.

Security News
Socket CEO Feross Aboukhadijeh breaks down how North Korea hijacked Axios and what it means for the future of software supply chain security.