
Security News
Axios Maintainer Confirms Social Engineering Attack Behind npm Compromise
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.
@alanmarcell/ptz-validations
Advanced tools
Validate your js objects.
npm install --save ptz-validations
Example test of how to create a function to validate user:
import * as assert from 'ptz-assert';
import * as V from './index';
describe('ptz-validations', () => {
it('createUser example', () => {
// Optional interface for Typescript projects
interface IUser {
id: string;
userName: string;
password: string;
email: string;
weight?: number;
birthday?: Date;
}
const validateUser = V.validate<IUser>({
id: [
V.generateId
],
displayName: [
V.required,
V.isString,
V.min(2),
V.max(100)
],
userName: [
V.required,
V.isString,
V.min(2),
V.max(40),
V.toLowerCase
],
password: [
V.required,
V.isString,
V.min(6),
V.max(40)
],
email: [
V.required,
V.isEmail
],
weight: [
V.isNumber,
V.min(1),
V.max(1000)
],
birthday: [
V.isDate,
V.min(new Date('1800-01-01')),
V.max(new Date())
]
});
const user = validateUser({
userName: 'angeloocana',
password: 'abcd',
email: 'angeloocana@gmail.com',
weight: 90,
birthday: '1992-06-28'
});
const expectedUser = {
id: 'hfk397d',
userName: 'angeloocana',
password: 'abcd',
email: 'angeloocana@gmail.com',
weight: 90,
birthday: new Date('1992-06-28'),
errors: [{
propName: 'displayName',
errorMsg: 'ERROR_REQUIRED'
}, {
propName: 'password',
errorMsg: 'ERROR_MIN'
}]
};
assert.ok(user.id, 'generate id');
assert.equal(user.userName, expectedUser.userName, 'set userName');
assert.equal(user.password, expectedUser.password, 'set password');
assert.equal(user.email, expectedUser.email, 'set email');
assert.equal(user.weight, expectedUser.weight, 'set weight');
assert.equal(user.birthday.toString(), expectedUser.birthday.toString(), 'set birthday');
assert.deepEqual(user.errors, expectedUser.errors, 'add errors');
});
});
npm install -g ts-node babel-cli
npm install
npm test
FAQs
Validate your js objects.
We found that @alanmarcell/ptz-validations demonstrated a not healthy version release cadence and project activity because the last version was released 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
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.

Security News
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.