
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
value-object-lib
Advanced tools
TypeScript library for creating and validating reusable, robust, and secure Value Objects—strings, numbers, emails, UUIDs, dates, enums, phone numbers, and more. Enables immutable domain logic and centralized validation for DDD-aligned applications.
Small TypeScript library for creating immutable, validated Value Objects (strings, numbers, emails, UUIDs, dates, enums, phone numbers, and more). Designed for domain usage (DDD) or any layer where you want centralized validation and invariants.
StringValueObject, NonEmptyStringValueObject, NumberValueObject, PositiveNumberValueObject, NonNegativeNumberValueObject, BooleanValueObject, DateValueObject, EmailValueObject, PhoneNumberValueObject, UUIDValueObject, EnumValueObject.Install from npm (once published):
npm install value-object-lib
# or
yarn add value-object-lib
Example (ESM / TypeScript):
import { NonEmptyStringValueObject, EmailValueObject } from 'value-object-lib';
const name = new NonEmptyStringValueObject('Edgar');
const email = new EmailValueObject('edgar@example.com');
console.log(name.value); // 'Edgar'
console.log(email.toString());
Example (CommonJS):
const { UUIDValueObject } = require('value-object-lib');
const id = new UUIDValueObject('3f2504e0-4f89-11d3-9a0c-0305e82c3301');
console.log(id.value);
Error handling:
import { EmailValueObject } from 'value-object-lib';
try {
new EmailValueObject('not-an-email');
} catch (err) {
// err is a ValueObjectValidationError with a message explaining the reason
console.error(err.message);
}
The package exports the value objects from the package root. Import only what you need:
import { StringValueObject, PositiveNumberValueObject, PhoneNumberValueObject } from 'value-object-lib';
Check the source (src/value-objects/) to see validations and available methods (value, toString(), toJSON(), equals()).
# clean and build
npm run build
# run tests
npm test
# preview what will be published
npm pack --dry-run
# publish (make sure you are logged in with `npm login`)
npm publish --access public
Note: the prepare script runs the build, so npm publish will trigger the build if dist/ is missing.
LICENSE file (e.g., MIT) and populate package.json with repository, bugs, and homepage fields.npm version patch|minor|major).dist/ (the files field is already configured). Make sure .d.ts files are published.npm test and npm run build before publishing.This repository includes a license file MIT.
FAQs
TypeScript library for creating and validating reusable, robust, and secure Value Objects—strings, numbers, emails, UUIDs, dates, enums, phone numbers, and more. Enables immutable domain logic and centralized validation for DDD-aligned applications.
We found that value-object-lib 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
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.