New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

satpam

Package Overview
Dependencies
Maintainers
1
Versions
114
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

satpam - npm Package Compare versions

Comparing version 0.0.2 to 0.0.3

tests/fixtures/dummyimg.jpeg

32

index.js

@@ -5,2 +5,6 @@ "use strict";

var _ = require('lodash');
var required = require('./validators/required');
var email = require('./validators/email');
var numeric = require('./validators/numeric');
var image = require('./validators/image');

@@ -32,25 +36,13 @@ /*

var validation = {
required: function(val) {
return !(val === undefined || val === null || val === '');
},
numeric: function(val) {
if (val) {
return stringValidator.isNumeric(val);
}
return true;
},
email: function(val) {
if (val) {
return stringValidator.isEmail(val);
}
return true;
}
required: required.validator,
numeric: numeric.validator,
email: email.validator,
image: image.validator
};
var validationMessages = {
email: '<%= propertyName %> must be email',
required: '<%= propertyName %> is required',
numeric: '<%= propertyName %> must be numeric'
required: required.message,
numeric: numeric.message,
email: email.message,
image: image.message
};

@@ -57,0 +49,0 @@

{
"name": "satpam",
"version": "0.0.2",
"description": "Object Validator",
"version": "0.0.3",
"description": "Simple and Effective Object Validator",
"main": "index.js",

@@ -9,7 +9,9 @@ "scripts": {

},
"repository": {
"type": "git",
"url": "github.com/sendyhalim/satpam"
},
"author": "Sendy Halim",
"repository": "sendyhalim/satpam",
"keywords": [
"validator",
"satpam",
"object validator"
],
"author": "Sendy Halim <sendyhalim93@gmail.com>",
"license": "ISC",

@@ -21,3 +23,5 @@ "bugs": {

"dependencies": {
"image-type": "^2.0.2",
"lodash": "^3.7.0",
"read-chunk": "^1.0.1",
"validator": "^3.39.0"

@@ -24,0 +28,0 @@ },

# satpam
-----
Satpam is a wrapper for some nodejs validator libraries, I made `Satpam` so it's easy to create
Satpam is a wrapper for some nodejs validator libraries, I made `Satpam` so it's easy to create
custom validator with parameters and custom validation messages.

@@ -9,3 +9,3 @@

## Quick Usage
```
```js
var satpam = require('satpam');

@@ -18,7 +18,7 @@ var rules = {

var input = {
name: 'Sendy',
title: 'Lord',
officeEmail: 'invalid email',
var input = {
name: 'Sendy',
title: 'Lord',
officeEmail: 'invalid email',
phone: 'hi there123'

@@ -35,3 +35,3 @@ };

result.messages.phone.number === 'Phone must be numeric';
// or get all messages in array form

@@ -44,3 +44,3 @@ result.messageArray[0] = 'OfficeEmail must be email';

## Custom rules
```
```js
validator.addCustomValidation('must-be-ironman', function(val) {

@@ -63,2 +63,7 @@ return val === 'ironman';

## TODOs
- Add more basic validation rules
- Validate file types
More examples -> [Here](https://github.com/sendyhalim/satpam/blob/master/tests/validator.spec.js)
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