Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

satpam

Package Overview
Dependencies
Maintainers
7
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 4.13.1 to 4.14.1

lib/frontend/index.js

185

lib/index.js

@@ -21,2 +21,4 @@ "use strict";

var _reduce = _interopRequireDefault(require("lodash/reduce"));
var _noes = _interopRequireDefault(require("noes"));

@@ -58,2 +60,4 @@

var _dateFormat = _interopRequireDefault(require("./validators/date-format"));
var _dateTimeAfter = _interopRequireDefault(require("./validators/date-time-after"));

@@ -67,4 +71,2 @@

var _dateFormat = _interopRequireDefault(require("./validators/date-format"));
var _email = _interopRequireDefault(require("./validators/email"));

@@ -186,153 +188,32 @@

var validation = {
'beginWith:$1': _beginWith["default"].validate,
'between:$1:$2': _between["default"].validate,
'dateAfter:$1:$2:$3:$4': _dateAfter["default"].validate,
'dateAfterOrEqual:$1:$2:$3:$4': _dateAfterOrEqual["default"].validate,
'dateBefore:$1:$2:$3:$4': _dateBefore["default"].validate,
'dateBeforeOrEqual:$1:$2:$3:$4': _dateBeforeOrEqual["default"].validate,
'dateFormat:$1': _dateFormat["default"].validate,
'dateTimeAfter:$1:$2:$3:$4': _dateTimeAfter["default"].validate,
'dateTimeAfterOrEqual:$1:$2:$3:$4': _dateTimeAfterOrEqual["default"].validate,
'dateTimeBefore:$1:$2:$3:$4': _dateTimeBefore["default"].validate,
'dateTimeBeforeOrEqual:$1:$2:$3:$4': _dateTimeBeforeOrEqual["default"].validate,
'equal:$1': _equal["default"].validate,
'equal-to-field:$1': _equalToField["default"].validate,
'fileType:$1': _fileType["default"].validate,
'indonesiaIdCardNumberBirthDate:$1:$2': _indonesiaIdCardNumberBirthDate["default"].validate,
'indonesiaIdCardNumberGender:$1:$2:$3': _indonesiaIdCardNumberGender["default"].validate,
'indonesiaIdCardNumberProvince:$1': _indonesiaIdCardNumberProvince["default"].validate,
'indonesiaIdCardNumberValidProvince': _indonesiaIdCardNumberValidProvince["default"].validate,
'indonesianName': _indonesianName["default"].validate,
'length:$1': _length["default"].validate,
'maxLength:$1': _maxLength["default"].validate,
'maxValue:$1': _maxValue["default"].validate,
'memberOf:$1': _memberOf["default"].validate,
'minLength:$1': _minLength["default"].validate,
'minValue:$1': _minValue["default"].validate,
'minimumAge:$1:$2': _minimumAge["default"].validate,
'multipleOf:$1': _multipleOf["default"].validate,
'not-equal:$1': _notEqual["default"].validate,
'not-equal-email-domain:$1': _notEqualEmailDomain["default"].validate,
'not-equal-to-field:$1': _notEqualToField["default"].validate,
'not-memberOf:$1': _notMemberOf["default"].validate,
'pattern:$1:$2': _pattern["default"].validate,
'requiredIf:$1:$2': _requiredIf["default"].validate,
'requiredIfNot:$1:$2': _requiredIfNot["default"].validate,
'some-memberOf:$1': _someMemberOf["default"].validate,
'taxId:$1': _taxId["default"].validate,
'timeAfter:$1:$2:$3': _timeAfter["default"].validate,
'timeAfterOrEqual:$1:$2:$3': _timeAfterOrEqual["default"].validate,
'timeBefore:$1:$2:$3': _timeBefore["default"].validate,
'timeBeforeOrEqual:$1:$2:$3': _timeBeforeOrEqual["default"].validate,
'urlProtocol:$1': _urlProtocol["default"].validate,
'uuid:$1': _uuid["default"].validate,
alpha: _alpha["default"].validate,
alphanumeric: _alphanumeric["default"].validate,
array: _array["default"].validate,
"boolean": _boolean2["default"].validate,
containsAlphabet: _containsAlphabet["default"].validate,
containsDigit: _containsDigit["default"].validate,
containsLowerCase: _containsLowerCase["default"].validate,
containsSymbol: _containsSymbol["default"].validate,
containsUpperCase: _containsUpperCase["default"].validate,
creditCard: _creditCard["default"].validate,
date: _date["default"].validate,
email: _email["default"].validate,
emptyString: _emptyString["default"].validate,
fqdn: _fqdn["default"].validate,
hostname: _hostname["default"].validate,
image: _image["default"].validate,
imei: _imei["default"].validate,
integer: _integer["default"].validate,
internationalPhoneNumber: _internationalPhoneNumber["default"].validate,
ip: _ip["default"].validate,
mobilePhoneNumber: _mobilePhoneNumber["default"].validate,
mongoId: _mongoId["default"].validate,
nonBlank: _nonBlank["default"].validate,
notDisposableEmail: _notDisposableEmail["default"].validate,
numeric: _numeric["default"].validate,
phoneNumber: _phoneNumber["default"].validate,
plainObject: _plainObject["default"].validate,
regex: _regex["default"].validate,
required: _required["default"].validate,
string: _string["default"].validate,
url: _url["default"].validate
};
var validationMessages = {
'beginWith:$1': _beginWith["default"].message,
'between:$1:$2': _between["default"].message,
'dateAfter:$1:$2:$3:$4': _dateAfter["default"].message,
'dateAfterOrEqual:$1:$2:$3:$4': _dateAfterOrEqual["default"].message,
'dateBefore:$1:$2:$3:$4': _dateBefore["default"].message,
'dateBeforeOrEqual:$1:$2:$3:$4': _dateBeforeOrEqual["default"].message,
'dateTimeAfter:$1:$2:$3:$4': _dateTimeAfter["default"].message,
'dateTimeAfterOrEqual:$1:$2:$3:$4': _dateTimeAfterOrEqual["default"].message,
'dateTimeBefore:$1:$2:$3:$4': _dateTimeBefore["default"].message,
'dateTimeBeforeOrEqual:$1:$2:$3:$4': _dateTimeBeforeOrEqual["default"].message,
'timeAfter:$1:$2:$3': _timeAfter["default"].message,
'timeAfterOrEqual:$1:$2:$3': _timeAfterOrEqual["default"].message,
'timeBefore:$1:$2:$3': _timeBefore["default"].message,
'timeBeforeOrEqual:$1:$2:$3': _timeBeforeOrEqual["default"].message,
'dateFormat:$1': _dateFormat["default"].message,
'equal:$1': _equal["default"].message,
'equal-to-field:$1': _equalToField["default"].message,
'fileType:$1': _fileType["default"].message,
'indonesiaIdCardNumberBirthDate:$1:$2': _indonesiaIdCardNumberBirthDate["default"].message,
'indonesiaIdCardNumberGender:$1:$2:$3': _indonesiaIdCardNumberGender["default"].message,
'indonesiaIdCardNumberProvince:$1': _indonesiaIdCardNumberProvince["default"].message,
'indonesiaIdCardNumberValidProvince': _indonesiaIdCardNumberValidProvince["default"].message,
'indonesianName': _indonesianName["default"].message,
'length:$1': _length["default"].message,
'maxLength:$1': _maxLength["default"].message,
'maxValue:$1': _maxValue["default"].message,
'memberOf:$1': _memberOf["default"].message,
'minLength:$1': _minLength["default"].message,
'minValue:$1': _minValue["default"].message,
'minimumAge:$1:$2': _minimumAge["default"].message,
'not-equal:$1': _notEqual["default"].message,
'not-equal-to-field:$1': _notEqualToField["default"].message,
'not-equal-email-domain:$1': _notEqualEmailDomain["default"].message,
'not-memberOf:$1': _notMemberOf["default"].message,
'pattern:$1:$2': _pattern["default"].message,
'requiredIf:$1:$2': _requiredIf["default"].message,
'requiredIfNot:$1:$2': _requiredIfNot["default"].message,
'some-memberOf:$1': _someMemberOf["default"].message,
'taxId:$1': _taxId["default"].message,
'multipleOf:$1': _multipleOf["default"].message,
alpha: _alpha["default"].message,
alphanumeric: _alphanumeric["default"].message,
array: _array["default"].message,
"boolean": _boolean2["default"].message,
containsAlphabet: _containsAlphabet["default"].message,
containsDigit: _containsDigit["default"].message,
containsSymbol: _containsSymbol["default"].message,
containsLowerCase: _containsLowerCase["default"].message,
containsUpperCase: _containsUpperCase["default"].message,
creditCard: _creditCard["default"].message,
date: _date["default"].message,
email: _email["default"].message,
emptyString: _emptyString["default"].message,
fqdn: _fqdn["default"].message,
hostname: _hostname["default"].message,
image: _image["default"].message,
imei: _imei["default"].message,
integer: _integer["default"].message,
internationalPhoneNumber: _internationalPhoneNumber["default"].message,
ip: _ip["default"].message,
mobilePhoneNumber: _mobilePhoneNumber["default"].message,
mongoId: _mongoId["default"].message,
nonBlank: _nonBlank["default"].message,
notDisposableEmail: _notDisposableEmail["default"].message,
numeric: _numeric["default"].message,
plainObject: _plainObject["default"].message,
phoneNumber: _phoneNumber["default"].message,
regex: _regex["default"].message,
required: _required["default"].message,
string: _string["default"].message,
url: _url["default"].message,
'urlProtocol:$1': _urlProtocol["default"].message,
'uuid:$1': _uuid["default"].message
};
var validators = [_alpha["default"], _alphanumeric["default"], _array["default"], _beginWith["default"], _between["default"], _boolean2["default"], _containsAlphabet["default"], _containsDigit["default"], _containsLowerCase["default"], _containsSymbol["default"], _containsUpperCase["default"], _creditCard["default"], _date["default"], _dateAfter["default"], _dateAfterOrEqual["default"], _dateBefore["default"], _dateBeforeOrEqual["default"], _dateTimeAfter["default"], _dateTimeAfterOrEqual["default"], _dateTimeBefore["default"], _dateTimeBeforeOrEqual["default"], _dateFormat["default"], _email["default"], _emptyString["default"], _equal["default"], _equalToField["default"], _fileType["default"], _fqdn["default"], _hostname["default"], _image["default"], _imei["default"], _indonesiaIdCardNumberBirthDate["default"], _indonesiaIdCardNumberGender["default"], _indonesiaIdCardNumberProvince["default"], _indonesiaIdCardNumberValidProvince["default"], _indonesianName["default"], _integer["default"], _internationalPhoneNumber["default"], _ip["default"], _length["default"], _maxLength["default"], _maxValue["default"], _memberOf["default"], _minLength["default"], _minValue["default"], _minimumAge["default"], _mobilePhoneNumber["default"], _mongoId["default"], _multipleOf["default"], _nonBlank["default"], _notDisposableEmail["default"], _notEqual["default"], _notEqualToField["default"], _notEqualEmailDomain["default"], _notMemberOf["default"], _numeric["default"], _pattern["default"], _phoneNumber["default"], _plainObject["default"], _regex["default"], _required["default"], _requiredIf["default"], _requiredIfNot["default"], _someMemberOf["default"], _string["default"], _taxId["default"], _timeAfter["default"], _timeAfterOrEqual["default"], _timeBefore["default"], _timeBeforeOrEqual["default"], _url["default"], _urlProtocol["default"], _uuid["default"]];
/**
* Validation by validator full name
* @example
* {
* [alpha.fullName]: alpha.validate,
* [alphanumeric.fullName]: alphanumeric.validate,
* ...
* }
*/
var validation = (0, _reduce["default"])(validators, function (result, validator) {
result[validator.fullName] = validator.validate;
return result;
}, {});
/**
* Validation message by validator full name
* @example
* {
* [alpha.fullName]: alpha.message,
* [alphanumeric.fullName]: alphanumeric.message,
* ...
* }
*/
var validationMessages = (0, _reduce["default"])(validators, function (result, validator) {
result[validator.fullName] = validator.message;
return result;
}, {});
var ValidationMessage = function ValidationMessage() {

@@ -339,0 +220,0 @@ _classCallCheck(this, ValidationMessage);

@@ -7,2 +7,3 @@ "use strict";

exports["default"] = void 0;
var fullName = 'alpha';
var alphaRegex = /^[A-Z ]+$/i;

@@ -20,2 +21,3 @@

var _default = {
fullName: fullName,
validate: validate,

@@ -22,0 +24,0 @@ message: message

@@ -7,2 +7,3 @@ "use strict";

exports["default"] = void 0;
var fullName = 'alphanumeric';
var alphanumericRegex = /^[0-9A-Z]+$/i;

@@ -20,2 +21,3 @@

var _default = {
fullName: fullName,
validate: validate,

@@ -22,0 +24,0 @@ message: message

@@ -14,2 +14,4 @@ "use strict";

var fullName = 'array';
var validate = function validate(val) {

@@ -26,2 +28,3 @@ // Only run validation if it's not nil.

var _default = {
fullName: fullName,
validate: validate,

@@ -28,0 +31,0 @@ message: message

@@ -26,2 +26,4 @@ "use strict";

var fullName = 'beginWith:$1';
var validate = function validate(val, ruleObj) {

@@ -43,2 +45,3 @@ if ((0, _isNil["default"])(val)) {

var _default = {
fullName: fullName,
validate: validate,

@@ -45,0 +48,0 @@ message: message

@@ -14,2 +14,3 @@ "use strict";

var fullName = 'between:$1:$2';
/**

@@ -24,2 +25,3 @@ * Check if the given value is between minimum value and maximum value

*/
var validate = function validate(val, ruleObj) {

@@ -41,2 +43,3 @@ if ((0, _isNil["default"])(val)) {

var _default = {
fullName: fullName,
validate: validate,

@@ -43,0 +46,0 @@ message: message

@@ -10,2 +10,4 @@ "use strict";

var fullName = 'boolean';
var validate = function validate(val) {

@@ -19,2 +21,3 @@ var type = _typeof(val);

var _default = {
fullName: fullName,
validate: validate,

@@ -21,0 +24,0 @@ message: message

@@ -12,2 +12,4 @@ "use strict";

var fullName = 'containsAlphabet';
var validate = function validate(val) {

@@ -27,2 +29,3 @@ if (_ramda["default"].isNil(val)) {

var _default = {
fullName: fullName,
validate: validate,

@@ -29,0 +32,0 @@ message: message

@@ -12,2 +12,4 @@ "use strict";

var fullName = 'containsDigit';
var validate = function validate(val) {

@@ -27,2 +29,3 @@ if (_ramda["default"].isNil(val)) {

var _default = {
fullName: fullName,
validate: validate,

@@ -29,0 +32,0 @@ message: message

@@ -12,2 +12,4 @@ "use strict";

var fullName = 'containsLowerCase';
var validate = function validate(val) {

@@ -27,2 +29,3 @@ if (_ramda["default"].isNil(val)) {

var _default = {
fullName: fullName,
validate: validate,

@@ -29,0 +32,0 @@ message: message

@@ -12,2 +12,4 @@ "use strict";

var fullName = 'containsSymbol';
var validate = function validate(val) {

@@ -27,2 +29,3 @@ if (_ramda["default"].isNil(val)) {

var _default = {
fullName: fullName,
validate: validate,

@@ -29,0 +32,0 @@ message: message

@@ -12,2 +12,4 @@ "use strict";

var fullName = 'containsUpperCase';
var validate = function validate(val) {

@@ -27,2 +29,3 @@ if (_ramda["default"].isNil(val)) {

var _default = {
fullName: fullName,
validate: validate,

@@ -29,0 +32,0 @@ message: message

@@ -7,3 +7,3 @@ "use strict";

exports["default"] = void 0;
var fullName = 'creditCard';
/**

@@ -19,2 +19,3 @@ * Validate credit card number.

*/
var validateCreditCard = function validateCreditCard(str) {

@@ -59,2 +60,3 @@ var sanitized = str.replace(/[^0-9]+/g, '');

var _default = {
fullName: fullName,
validate: validate,

@@ -61,0 +63,0 @@ message: message

@@ -14,2 +14,3 @@ "use strict";

var fullName = 'dateAfterOrEqual:$1:$2:$3:$4';
var NOW = 'now';

@@ -57,2 +58,3 @@ var defaultMessage = '<%= propertyName %> must be greater than or equal to <%= ruleParams[1] %>.'; // Use object (it will be passed as reference at index.js) to represent the message,

var _default = {
fullName: fullName,
validate: validate,

@@ -59,0 +61,0 @@ message: message

@@ -14,2 +14,3 @@ "use strict";

var fullName = 'dateAfter:$1:$2:$3:$4';
var NOW = 'now';

@@ -57,2 +58,3 @@ var defaultMessage = '<%= propertyName %> must greater than <%= ruleParams[1] %>.'; // Use object (it will be passed as reference at index.js) to represent the message,

var _default = {
fullName: fullName,
validate: validate,

@@ -59,0 +61,0 @@ message: message

@@ -14,2 +14,3 @@ "use strict";

var fullName = 'dateBeforeOrEqual:$1:$2:$3:$4';
var NOW = 'now';

@@ -57,2 +58,3 @@ var defaultMessage = '<%= propertyName %> must be less than or equal to <%= ruleParams[1] %>.'; // Use object (it will be passed as reference at index.js) to represent the message,

var _default = {
fullName: fullName,
validate: validate,

@@ -59,0 +61,0 @@ message: message

@@ -14,2 +14,3 @@ "use strict";

var fullName = 'dateBefore:$1:$2:$3:$4';
var NOW = 'now';

@@ -57,2 +58,3 @@ var defaultMessage = '<%= propertyName %> must less than <%= ruleParams[1] %>.'; // Use object (it will be passed as reference at index.js) to represent the message,

var _default = {
fullName: fullName,
validate: validate,

@@ -59,0 +61,0 @@ message: message

@@ -12,2 +12,4 @@ "use strict";

var fullName = 'dateFormat:$1';
var validate = function validate(val, ruleObj) {

@@ -23,2 +25,3 @@ if (!val) {

var _default = {
fullName: fullName,
validate: validate,

@@ -25,0 +28,0 @@ message: message

@@ -14,2 +14,3 @@ "use strict";

var fullName = 'dateTimeAfterOrEqual:$1:$2:$3:$4';
var NOW = 'now';

@@ -57,2 +58,3 @@ var defaultMessage = '<%= propertyName %> must be greater than or equal to <%= ruleParams[1] %>.'; // Use object (it will be passed as reference at index.js) to represent the message,

var _default = {
fullName: fullName,
validate: validate,

@@ -59,0 +61,0 @@ message: message

@@ -14,2 +14,3 @@ "use strict";

var fullName = 'dateTimeAfter:$1:$2:$3:$4';
var NOW = 'now';

@@ -57,2 +58,3 @@ var defaultMessage = '<%= propertyName %> must greater than <%= ruleParams[1] %>.'; // Use object (it will be passed as reference at index.js) to represent the message,

var _default = {
fullName: fullName,
validate: validate,

@@ -59,0 +61,0 @@ message: message

@@ -14,2 +14,3 @@ "use strict";

var fullName = 'dateTimeBeforeOrEqual:$1:$2:$3:$4';
var NOW = 'now';

@@ -57,2 +58,3 @@ var defaultMessage = '<%= propertyName %> must be less than or equal to <%= ruleParams[1] %>.'; // Use object (it will be passed as reference at index.js) to represent the message,

var _default = {
fullName: fullName,
validate: validate,

@@ -59,0 +61,0 @@ message: message

@@ -14,2 +14,3 @@ "use strict";

var fullName = 'dateTimeBefore:$1:$2:$3:$4';
var NOW = 'now';

@@ -57,2 +58,3 @@ var defaultMessage = '<%= propertyName %> must be less than <%= ruleParams[1] %>.'; // Use object (it will be passed as reference at index.js) to represent the message,

var _default = {
fullName: fullName,
validate: validate,

@@ -59,0 +61,0 @@ message: message

@@ -12,2 +12,4 @@ "use strict";

var fullName = 'date';
var validate = function validate(val) {

@@ -23,2 +25,3 @@ if (val) {

var _default = {
fullName: fullName,
validate: validate,

@@ -25,0 +28,0 @@ message: message

@@ -18,2 +18,3 @@ "use strict";

var fullName = 'email';
/**

@@ -26,2 +27,3 @@ * Validate email

*/
var emailUserUtf8Regex = /^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))$/i;

@@ -57,2 +59,3 @@

var _default = {
fullName: fullName,
validate: validate,

@@ -59,0 +62,0 @@ message: message

@@ -12,5 +12,7 @@ "use strict";

var fullName = 'emptyString';
var validate = (0, _equals["default"])('');
var message = '<%= propertyName %> field must be an empty string.';
var _default = {
fullName: fullName,
validate: validate,

@@ -17,0 +19,0 @@ message: message

@@ -7,2 +7,3 @@ "use strict";

exports["default"] = void 0;
var fullName = 'equal-to-field:$1';

@@ -15,2 +16,3 @@ var validate = function validate(val, ruleObj, propertyName, inputObj) {

var _default = {
fullName: fullName,
validate: validate,

@@ -17,0 +19,0 @@ message: message

@@ -7,2 +7,3 @@ "use strict";

exports["default"] = void 0;
var fullName = 'equal:$1';

@@ -15,2 +16,3 @@ var validate = function validate(val, ruleObj) {

var _default = {
fullName: fullName,
validate: validate,

@@ -17,0 +19,0 @@ message: message

@@ -16,2 +16,4 @@ "use strict";

var fullName = 'fileType:$1';
var validate = function validate(val, ruleObj) {

@@ -36,2 +38,3 @@ if (!val) {

var _default = {
fullName: fullName,
validate: validate,

@@ -38,0 +41,0 @@ message: message

@@ -7,2 +7,3 @@ "use strict";

exports["default"] = void 0;
var fullName = 'fqdn';

@@ -38,2 +39,3 @@ var validate = function validate(val) {

var _default = {
fullName: fullName,
validate: validate,

@@ -40,0 +42,0 @@ message: message

@@ -9,2 +9,3 @@ "use strict";

var ValidHostNameRegex = new RegExp(ValidHostNamePattern);
var fullName = 'hostname';

@@ -21,2 +22,3 @@ var validate = function validate(val) {

var _default = {
fullName: fullName,
validate: validate,

@@ -23,0 +25,0 @@ message: message

@@ -16,2 +16,4 @@ "use strict";

var fullName = 'image';
var validate = function validate(val) {

@@ -35,2 +37,3 @@ if (!val) {

var _default = {
fullName: fullName,
validate: validate,

@@ -37,0 +40,0 @@ message: message

@@ -7,3 +7,3 @@ "use strict";

exports["default"] = void 0;
var fullName = 'imei';
/**

@@ -16,2 +16,3 @@ * Validate IMEI number.

*/
var validate = function validate(value) {

@@ -42,2 +43,3 @@ if (!value) {

var _default = {
fullName: fullName,
validate: validate,

@@ -44,0 +46,0 @@ message: message

@@ -12,2 +12,4 @@ "use strict";

var fullName = 'indonesiaIdCardNumberBirthDate:$1:$2';
var validate = function validate(value, ruleObj, propertyName, inputObj) {

@@ -43,2 +45,3 @@ // Do not validate if input value is falsy.

var _default = {
fullName: fullName,
validate: validate,

@@ -45,0 +48,0 @@ message: message

@@ -7,2 +7,3 @@ "use strict";

exports["default"] = void 0;
var fullName = 'indonesiaIdCardNumberGender:$1:$2:$3';

@@ -31,2 +32,3 @@ var validate = function validate(value, ruleObj, propertyName, inputObj) {

var _default = {
fullName: fullName,
validate: validate,

@@ -33,0 +35,0 @@ message: message

@@ -7,2 +7,3 @@ "use strict";

exports["default"] = void 0;
var fullName = 'indonesiaIdCardNumberProvince:$1';
var provinceCodeMapping = {

@@ -64,2 +65,3 @@ 'ACEH': 11,

var _default = {
fullName: fullName,
validate: validate,

@@ -66,0 +68,0 @@ message: message

@@ -7,2 +7,3 @@ "use strict";

exports["default"] = void 0;
var fullName = 'indonesiaIdCardNumberValidProvince';
var provinceCodeMapping = {

@@ -91,2 +92,3 @@ 11: true,

var _default = {
fullName: fullName,
validate: validate,

@@ -93,0 +95,0 @@ message: message

@@ -7,2 +7,3 @@ "use strict";

exports["default"] = void 0;
var fullName = 'indonesianName';
var regexp = /^[a-zA-Z][a-zA-Z\.\-\'\,/\s]*$/;

@@ -30,2 +31,3 @@ /**

var _default = {
fullName: fullName,
validate: validate,

@@ -32,0 +34,0 @@ message: message

@@ -16,2 +16,4 @@ "use strict";

var fullName = 'integer';
var validate = function validate(val) {

@@ -34,2 +36,3 @@ if ((0, _isNil["default"])(val)) {

var _default = {
fullName: fullName,
validate: validate,

@@ -36,0 +39,0 @@ message: message

@@ -7,3 +7,4 @@ "use strict";

exports["default"] = void 0;
// Maximum international mobile phone number length including country code is 15 digits. Source: https://en.wikipedia.org/wiki/E.164
var fullName = 'internationalPhoneNumber'; // Maximum international mobile phone number length including country code is 15 digits. Source: https://en.wikipedia.org/wiki/E.164
var internationalPhoneNumberRegExp = /^\+?[0-9]{2,15}$/;

@@ -506,2 +507,3 @@ /**

var _default = {
fullName: fullName,
validate: validate,

@@ -508,0 +510,0 @@ message: message

@@ -7,3 +7,3 @@ "use strict";

exports["default"] = void 0;
var fullName = 'ip';
/**

@@ -16,2 +16,3 @@ * Validate IPv4

*/
function isIPv4(val) {

@@ -96,2 +97,3 @@ // It will accept anything with three dots (.) and numeric digits

var _default = {
fullName: fullName,
validate: validate,

@@ -98,0 +100,0 @@ message: message

@@ -14,2 +14,4 @@ "use strict";

var fullName = 'length:$1';
var validate = function validate(val, ruleObj) {

@@ -26,2 +28,3 @@ if ((0, _isNil["default"])(val)) {

var _default = {
fullName: fullName,
validate: validate,

@@ -28,0 +31,0 @@ message: message

@@ -14,2 +14,4 @@ "use strict";

var fullName = 'maxLength:$1';
var validate = function validate(val, ruleObj) {

@@ -26,2 +28,3 @@ if ((0, _isNil["default"])(val)) {

var _default = {
fullName: fullName,
validate: validate,

@@ -28,0 +31,0 @@ message: message

@@ -14,2 +14,4 @@ "use strict";

var fullName = 'maxValue:$1';
var validate = function validate(val, ruleObj) {

@@ -31,2 +33,3 @@ if ((0, _isNil["default"])(val)) {

var _default = {
fullName: fullName,
validate: validate,

@@ -33,0 +36,0 @@ message: message

@@ -16,2 +16,4 @@ "use strict";

var fullName = 'memberOf:$1';
var validate = function validate(val, ruleObj) {

@@ -34,2 +36,3 @@ if ((0, _isNil["default"])(val)) {

var _default = {
fullName: fullName,
validate: validate,

@@ -36,0 +39,0 @@ message: message

@@ -14,2 +14,4 @@ "use strict";

var fullName = 'minLength:$1';
var validate = function validate(val, ruleObj) {

@@ -26,2 +28,3 @@ if ((0, _isNil["default"])(val)) {

var _default = {
fullName: fullName,
validate: validate,

@@ -28,0 +31,0 @@ message: message

@@ -14,2 +14,4 @@ "use strict";

var fullName = 'minValue:$1';
var validate = function validate(val, ruleObj) {

@@ -31,2 +33,3 @@ if ((0, _isNil["default"])(val)) {

var _default = {
fullName: fullName,
validate: validate,

@@ -33,0 +36,0 @@ message: message

@@ -16,2 +16,3 @@ "use strict";

var fullName = 'minimumAge:$1:$2';
var message = 'Minimum age is <%= ruleParams[0] %> years old.';

@@ -47,2 +48,3 @@ /**

var _default = {
fullName: fullName,
validate: validate,

@@ -49,0 +51,0 @@ message: message

@@ -14,2 +14,3 @@ "use strict";

var fullName = 'mobilePhoneNumber';
var mobilePhoneNumberRegex = /^(08|628|\+628)[0-9]{8,12}$/;

@@ -121,2 +122,3 @@ /**

var _default = {
fullName: fullName,
validate: validate,

@@ -123,0 +125,0 @@ message: message

@@ -7,4 +7,5 @@ "use strict";

exports["default"] = void 0;
// A regex to check whether the given string is a valid object id
var fullName = 'mongoId'; // A regex to check whether the given string is a valid object id
// https://github.com/Automattic/mongoose/issues/1959
var regex = /^[a-fA-F0-9]{24}$/;

@@ -22,2 +23,3 @@

var _default = {
fullName: fullName,
validate: validate,

@@ -24,0 +26,0 @@ message: message

@@ -7,2 +7,3 @@ "use strict";

exports["default"] = void 0;
var fullName = 'multipleOf:$1';

@@ -15,2 +16,3 @@ var validate = function validate(val, ruleObj) {

var _default = {
fullName: fullName,
validate: validate,

@@ -17,0 +19,0 @@ message: message

@@ -16,2 +16,4 @@ "use strict";

var fullName = 'nonBlank';
var validate = function validate(val) {

@@ -24,2 +26,3 @@ var trimmedValue = (0, _is["default"])(String, val) ? (0, _trim["default"])(val) : val;

var _default = {
fullName: fullName,
validate: validate,

@@ -26,0 +29,0 @@ message: message

@@ -20,2 +20,3 @@ "use strict";

var DISPOSABLE_EMAIL_DOMAIN_SET = new Set(DISPOSABLE_EMAIL_LIST);
var fullName = 'notDisposableEmail';

@@ -50,2 +51,3 @@ var validate = function validate(val) {

var _default = {
fullName: fullName,
validate: validate,

@@ -52,0 +54,0 @@ message: message

@@ -12,2 +12,3 @@ "use strict";

var fullName = 'not-equal-email-domain:$1';
/**

@@ -22,2 +23,3 @@ * Validate email's domain to not equal to the listed domains

*/
var validate = function validate(val, ruleObj) {

@@ -52,2 +54,3 @@ if (!val) {

var _default = {
fullName: fullName,
validate: validate,

@@ -54,0 +57,0 @@ message: message

@@ -14,5 +14,7 @@ "use strict";

var fullName = 'not-equal-to-field:$1';
var validate = (0, _complement["default"])(_equalToField["default"].validate);
var message = '<%= propertyName %> must not equal to <%= inputObj[ruleParams[0]] %>.';
var _default = {
fullName: fullName,
validate: validate,

@@ -19,0 +21,0 @@ message: message

@@ -14,5 +14,7 @@ "use strict";

var fullName = 'not-equal:$1';
var validate = (0, _complement["default"])(_equal["default"].validate);
var message = '<%= propertyName %> must not equal to <%= ruleParams[0] %>.';
var _default = {
fullName: fullName,
validate: validate,

@@ -19,0 +21,0 @@ message: message

@@ -16,2 +16,4 @@ "use strict";

var fullName = 'not-memberOf:$1';
var validate = function validate(val, ruleObj) {

@@ -34,2 +36,3 @@ if ((0, _isNil["default"])(val)) {

var _default = {
fullName: fullName,
validate: validate,

@@ -36,0 +39,0 @@ message: message

@@ -7,2 +7,3 @@ "use strict";

exports["default"] = void 0;
var fullName = 'numeric';

@@ -19,2 +20,3 @@ var validate = function validate(val) {

var _default = {
fullName: fullName,
validate: validate,

@@ -21,0 +23,0 @@ message: message

@@ -14,2 +14,4 @@ "use strict";

var fullName = 'pattern:$1:$2';
var validate = function validate(val, ruleObj) {

@@ -32,2 +34,3 @@ if ((0, _isNil["default"])(val)) {

var _default = {
fullName: fullName,
validate: validate,

@@ -34,0 +37,0 @@ message: message

@@ -7,2 +7,3 @@ "use strict";

exports["default"] = void 0;
var fullName = 'phoneNumber';
var phoneNumberRegex = /^(0|62|\+62)[0-9]{6,15}$/;

@@ -20,2 +21,3 @@

var _default = {
fullName: fullName,
validate: validate,

@@ -22,0 +24,0 @@ message: message

@@ -12,2 +12,4 @@ "use strict";

var fullName = 'plainObject';
var validate = function validate(val) {

@@ -23,2 +25,3 @@ if ((0, _isNil["default"])(val)) {

var _default = {
fullName: fullName,
validate: validate,

@@ -25,0 +28,0 @@ message: message

@@ -12,2 +12,4 @@ "use strict";

var fullName = 'regex';
var validate = function validate(val) {

@@ -28,2 +30,3 @@ if ((0, _isNil["default"])(val)) {

var _default = {
fullName: fullName,
validate: validate,

@@ -30,0 +33,0 @@ message: message

@@ -16,2 +16,4 @@ "use strict";

var fullName = 'requiredIfNot:$1:$2';
var validate = function validate(val, ruleObj, propertyName, inputObj) {

@@ -34,2 +36,3 @@ var params = ruleObj.params;

var _default = {
fullName: fullName,
validate: validate,

@@ -36,0 +39,0 @@ message: message

@@ -16,2 +16,4 @@ "use strict";

var fullName = 'requiredIf:$1:$2';
var validate = function validate(val, ruleObj, propertyName, inputObj) {

@@ -34,2 +36,3 @@ var params = ruleObj.params;

var _default = {
fullName: fullName,
validate: validate,

@@ -36,0 +39,0 @@ message: message

@@ -7,2 +7,3 @@ "use strict";

exports["default"] = void 0;
var fullName = 'required';

@@ -15,2 +16,3 @@ var validate = function validate(val) {

var _default = {
fullName: fullName,
validate: validate,

@@ -17,0 +19,0 @@ message: message

@@ -12,2 +12,4 @@ "use strict";

var fullName = 'some-memberOf:$1';
var validate = function validate(val, ruleObj) {

@@ -30,2 +32,3 @@ if (_lodash["default"].isUndefined(val)) {

var _default = {
fullName: fullName,
validate: validate,

@@ -32,0 +35,0 @@ message: message

@@ -14,2 +14,4 @@ "use strict";

var fullName = 'string';
var validate = function validate(val) {

@@ -26,2 +28,3 @@ // Only run validation if it's not nil.

var _default = {
fullName: fullName,
validate: validate,

@@ -28,0 +31,0 @@ message: message

@@ -12,2 +12,3 @@ "use strict";

var fullName = 'taxId:$1';
var hasNonDigit = (0, _any["default"])(isNaN);

@@ -69,2 +70,3 @@ var STRATEGY = {

var _default = {
fullName: fullName,
validate: validate,

@@ -71,0 +73,0 @@ message: message

@@ -16,2 +16,3 @@ "use strict";

var fullName = 'timeAfterOrEqual:$1:$2:$3';
var NOW = 'NOW';

@@ -59,2 +60,3 @@ var messages; // Use object (it will be passed as reference at index.js) to represent the message,

var _default = {
fullName: fullName,
validate: validate,

@@ -61,0 +63,0 @@ message: message

@@ -16,2 +16,3 @@ "use strict";

var fullName = 'timeAfter:$1:$2:$3';
var NOW = 'NOW';

@@ -59,2 +60,3 @@ var messages; // Use object (it will be passed as reference at index.js) to represent the message,

var _default = {
fullName: fullName,
validate: validate,

@@ -61,0 +63,0 @@ message: message

@@ -16,2 +16,3 @@ "use strict";

var fullName = 'timeBeforeOrEqual:$1:$2:$3';
var NOW = 'NOW';

@@ -59,2 +60,3 @@ var messages; // Use object (it will be passed as reference at index.js) to represent the message,

var _default = {
fullName: fullName,
validate: validate,

@@ -61,0 +63,0 @@ message: message

@@ -16,2 +16,3 @@ "use strict";

var fullName = 'timeBefore:$1:$2:$3';
var NOW = 'NOW';

@@ -59,2 +60,3 @@ var messages; // Use object (it will be passed as reference at index.js) to represent the message,

var _default = {
fullName: fullName,
validate: validate,

@@ -61,0 +63,0 @@ message: message

@@ -12,2 +12,4 @@ "use strict";

var fullName = 'urlProtocol:$1';
var validate = function validate(val, ruleObj) {

@@ -35,2 +37,3 @@ if (!val) {

var _default = {
fullName: fullName,
validate: validate,

@@ -37,0 +40,0 @@ message: message

@@ -21,2 +21,4 @@ "use strict";

*/
var fullName = 'url';
var validate = function validate(val) {

@@ -84,2 +86,3 @@ if (!val) {

var _default = {
fullName: fullName,
validate: validate,

@@ -86,0 +89,0 @@ message: message

@@ -12,4 +12,5 @@ "use strict";

// A regex to check whether the given string is a valid uuid
var fullName = 'uuid:$1'; // A regex to check whether the given string is a valid uuid
// https://github.com/chriso/validator.js/blob/master/src/lib/isUUID.js
var uuid = {

@@ -34,2 +35,3 @@ v1: /^[0-9A-F]{8}-[0-9A-F]{4}-1[0-9A-F]{3}-[0-9A-F]{4}-[0-9A-F]{12}$/i,

var _default = {
fullName: fullName,
validate: validate,

@@ -36,0 +38,0 @@ message: message

{
"name": "satpam",
"version": "4.13.1",
"version": "4.14.1",
"description": "Simple and Effective Object Validator",

@@ -5,0 +5,0 @@ "main": "lib/index.js",

@@ -64,2 +64,26 @@ # Satpam

## Front End Usage
For front end usage, you can use the dedicated front end lib.
```js
import satpam from 'satpam/lib/frontend';
```
Additionally, it's better to create your own validator instance with only the needed rules.
This will help reduce build size especially if your front end application is intended for end users.
```js
import Validator from 'satpam/lib/frontend/validator';
import minLength from 'satpam/lib/validators/min-length';
import maxLength from 'satpam/lib/validators/max-length';
const customValidator = new Validator({
validators: [minLength, maxLength]
});
const result = customValidator.validate(
{ token: ['minLength:11', 'maxLength:16'] },
{ token: '12345' }
);
```
## Available Rules

@@ -66,0 +90,0 @@ - `required`

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