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

availity-reactstrap-validation

Package Overview
Dependencies
Maintainers
2
Versions
66
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

availity-reactstrap-validation - npm Package Compare versions

Comparing version 1.1.1 to 1.2.0

lib/AvRadio.js

173

lib/AvBaseInput.js

@@ -9,4 +9,2 @@ 'use strict';

var _react2 = _interopRequireDefault(_react);
var _lodash = require('lodash.isundefined');

@@ -34,22 +32,35 @@

function AvBaseInput(props) {
function AvBaseInput() {
var _temp, _this, _ret;
_classCallCheck(this, AvBaseInput);
var _this = _possibleConstructorReturn(this, _Component.call(this, props));
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
_this.onKeyUpHandler = _this.onKeyUpHandler.bind(_this);
_this.onBlurHandler = _this.onBlurHandler.bind(_this);
_this.onInputHandler = _this.onInputHandler.bind(_this);
_this.onFocusHandler = _this.onFocusHandler.bind(_this);
_this.onChangeHandler = _this.onChangeHandler.bind(_this);
_this.validate = _this.validate.bind(_this);
_this.value = '';
_this.state = {
value: _this.value
};
_this.validations = props.validate;
return _this;
return _ret = (_temp = (_this = _possibleConstructorReturn(this, _Component.call.apply(_Component, [this].concat(args))), _this), _this.state = { value: '' }, _this.onKeyUpHandler = function (event) {
if (event && event.target && event.target.validity && event.target.validity.badInput !== _this.context.FormCtrl.isBad[_this.props.name] && (event.target.validity.badInput !== false || _this.context.FormCtrl.isBad[_this.props.name] !== undefined)) {
_this.context.FormCtrl.setBad(_this.props.name, event.target.validity.badInput);
_this.validate();
}
_this.props.onKeyUp && _this.props.onKeyUp(event);
}, _this.onInputHandler = function (_value) {
_this.value = getFieldValue(_value);
_this.validateEvent('onInput');
!_this.context.FormCtrl.isTouched[_this.props.name] && _this.context.FormCtrl.setTouched(_this.props.name);
}, _this.onBlurHandler = function (_value) {
_this.value = getFieldValue(_value);
_this.validateEvent('onBlur');
!_this.context.FormCtrl.isTouched[_this.props.name] && _this.context.FormCtrl.setTouched(_this.props.name);
}, _this.onFocusHandler = function (_value) {
_this.value = getFieldValue(_value);
_this.validateEvent('onFocus');
}, _this.onChangeHandler = function (_value) {
_this.value = getFieldValue(_value);
_this.validateEvent('onChange');
!_this.context.FormCtrl.isDirty[_this.props.name] && _this.context.FormCtrl.setDirty(_this.props.name);
}, _this.validations = {}, _this.value = '', _this.validate = function () {
_this.context.FormCtrl.validate(_this.props.name);
}, _temp), _possibleConstructorReturn(_this, _ret);
}

@@ -71,25 +82,2 @@

AvBaseInput.prototype.updateValidations = function updateValidations() {
var _this2 = this;
this.validations = Object.assign({}, this.props.validate);
if (htmlValidationTypes.indexOf(this.props.type) > -1) {
this.validations[this.props.type] = this.validations[this.props.type] || true;
}
Object.keys(this.props).filter(function (val) {
return htmlValidationAttrs.indexOf(val) > -1;
}).forEach(function (attr) {
if (_this2.props[attr]) {
_this2.validations[attr] = _this2.validations[attr] || { value: _this2.props[attr] };
} else {
delete _this2.validations[attr];
}
});
this.context.FormCtrl.register(this);
this.validate();
};
AvBaseInput.prototype.componentWillUnmount = function componentWillUnmount() {

@@ -111,55 +99,2 @@ this.context.FormCtrl.unregister(this);

AvBaseInput.prototype.onKeyUpHandler = function onKeyUpHandler(event) {
if (event && event.target && event.target.validity && event.target.validity.badInput !== this.context.FormCtrl.isBad[this.props.name] && (event.target.validity.badInput !== false || this.context.FormCtrl.isBad[this.props.name] !== undefined)) {
this.context.FormCtrl.setBad(this.props.name, event.target.validity.badInput);
this.validate();
}
this.props.onKeyUp && this.props.onKeyUp(event);
};
AvBaseInput.prototype.onInputHandler = function onInputHandler(_value) {
this.value = getFieldValue(_value);
this.validateEvent('onInput');
!this.context.FormCtrl.isTouched[this.props.name] && this.context.FormCtrl.setTouched(this.props.name);
};
AvBaseInput.prototype.onBlurHandler = function onBlurHandler(_value) {
this.value = getFieldValue(_value);
this.validateEvent('onBlur');
!this.context.FormCtrl.isTouched[this.props.name] && this.context.FormCtrl.setTouched(this.props.name);
};
AvBaseInput.prototype.onFocusHandler = function onFocusHandler(_value) {
this.value = getFieldValue(_value);
this.validateEvent('onFocus');
};
AvBaseInput.prototype.onChangeHandler = function onChangeHandler(_value) {
this.value = getFieldValue(_value);
this.validateEvent('onChange');
!this.context.FormCtrl.isDirty[this.props.name] && this.context.FormCtrl.setDirty(this.props.name);
};
AvBaseInput.prototype.validateEvent = function validateEvent(eventName) {
if (this.getValidationEvent() === eventName) {
this.setState({ value: this.value });
this.validate();
}
this.props[eventName] && this.props[eventName](this.value);
};
AvBaseInput.prototype.validate = function validate() {
this.context.FormCtrl.validate(this.props.name);
};
AvBaseInput.prototype.reset = function reset() {
this.value = this.getDefaultValue().value;
this.context.FormCtrl.setDirty(this.props.name, false);
this.context.FormCtrl.setTouched(this.props.name, false);
this.context.FormCtrl.setBad(this.props.name, false);
this.setState({ value: this.value });
this.validate();
this.props.onReset && this.props.onReset(this.value);
};
AvBaseInput.prototype.getValidationEvent = function getValidationEvent() {

@@ -170,3 +105,3 @@ return this.props.validationEvent ? this.props.validationEvent : this.context.FormCtrl.validationEvent;

AvBaseInput.prototype.getValidatorProps = function getValidatorProps() {
var _this3 = this;
var _this2 = this;

@@ -177,3 +112,3 @@ var state = this.props.state && this.context.FormCtrl.getInputState(this.props.name);

}).reduce(function (result, item) {
result[item] = _this3.props.validate[item].value || _this3.props.validate[item];
result[item] = _this2.props.validate[item].value || _this2.props.validate[item];
return result;

@@ -202,2 +137,43 @@ }, {});

AvBaseInput.prototype.reset = function reset() {
this.value = this.getDefaultValue().value;
this.context.FormCtrl.setDirty(this.props.name, false);
this.context.FormCtrl.setTouched(this.props.name, false);
this.context.FormCtrl.setBad(this.props.name, false);
this.setState({ value: this.value });
this.validate();
this.props.onReset && this.props.onReset(this.value);
};
AvBaseInput.prototype.validateEvent = function validateEvent(eventName) {
if (this.getValidationEvent() === eventName) {
this.setState({ value: this.value });
this.validate();
}
this.props[eventName] && this.props[eventName](this.value);
};
AvBaseInput.prototype.updateValidations = function updateValidations() {
var _this3 = this;
this.validations = Object.assign({}, this.props.validate);
if (htmlValidationTypes.indexOf(this.props.type) > -1) {
this.validations[this.props.type] = this.validations[this.props.type] || true;
}
Object.keys(this.props).filter(function (val) {
return htmlValidationAttrs.indexOf(val) > -1;
}).forEach(function (attr) {
if (_this3.props[attr]) {
_this3.validations[attr] = _this3.validations[attr] || { value: _this3.props[attr] };
} else {
delete _this3.validations[attr];
}
});
this.context.FormCtrl.register(this);
this.validate();
};
return AvBaseInput;

@@ -210,2 +186,5 @@ }(_react.Component);

validate: _react.PropTypes.object,
value: _react.PropTypes.any,
state: _react.PropTypes.bool,
type: _react.PropTypes.string,
onKeyUp: _react.PropTypes.func,

@@ -212,0 +191,0 @@ onInput: _react.PropTypes.func,

@@ -57,3 +57,3 @@ 'use strict';

var children = _props.children;
var id = _props.id;
var omit = _props.id;
var size = _props.size;

@@ -68,3 +68,3 @@ var disabled = _props.disabled;

id = id || attributes.name;
var id = this.props.id || attributes.name;

@@ -71,0 +71,0 @@ if (grid) {

@@ -41,6 +41,6 @@ 'use strict';

function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
function _asyncToGenerator(fn) { return function () { var gen = fn.apply(this, arguments); return new Promise(function (resolve, reject) { function step(key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { return Promise.resolve(value).then(function (value) { return step("next", value); }, function (err) { return step("throw", err); }); } } return step("next"); }); }; }
function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

@@ -57,5 +57,4 @@

return errorMessage[ruleName];
} else {
return errorMessage;
}
return errorMessage;
};

@@ -66,8 +65,14 @@

function AvForm(props) {
function AvForm() {
var _this2 = this;
var _temp, _this, _ret;
_classCallCheck(this, AvForm);
var _this = _possibleConstructorReturn(this, _InputContainer.call(this, props));
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
_this.state = {
return _ret = (_temp = (_this = _possibleConstructorReturn(this, _InputContainer.call.apply(_InputContainer, [this].concat(args))), _this), _this.state = {
invalidInputs: {},

@@ -78,7 +83,55 @@ dirtyInputs: {},

submitted: false
};
}, _this.validations = {}, _this.handleSubmit = function () {
var _ref = _asyncToGenerator(regeneratorRuntime.mark(function _callee(e) {
var values, _ref2, isValid, errors;
_this.handleSubmit = _this.handleSubmit.bind(_this);
_this.handleNonFormSubmission = _this.handleNonFormSubmission.bind(_this);
return _this;
return regeneratorRuntime.wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
if (e && typeof e.preventDefault === 'function') {
e.preventDefault();
}
values = _this.getValues();
_context.next = 4;
return _this.validateAll(values);
case 4:
_ref2 = _context.sent;
isValid = _ref2.isValid;
errors = _ref2.errors;
_this.setTouched(Object.keys(_this._inputs));
_this.props.onSubmit(e, errors, values);
if (isValid) {
_this.props.onValidSubmit(e, values);
} else {
_this.props.onInvalidSubmit(e, errors, values);
}
!_this.state.submitted && _this.setState({ submitted: true });
case 11:
case 'end':
return _context.stop();
}
}
}, _callee, _this2);
}));
return function (_x) {
return _ref.apply(this, arguments);
};
}(), _this.handleNonFormSubmission = function (event) {
if (_this.props.onKeyDown(event) !== false) {
if (event.type === 'keydown' && (event.which === 13 || event.keyCode === 13 || event.key === 'Enter')) {
event.stopPropagation();
event.preventDefault();
_this.handleSubmit(event);
}
}
}, _temp), _possibleConstructorReturn(_this, _ret);
}

@@ -128,23 +181,13 @@

AvForm.prototype.handleNonFormSubmission = function handleNonFormSubmission(event) {
if (this.props.onKeyDown(event) !== false) {
if (event.type === 'keydown' && (event.which === 13 || event.keyCode === 13 || event.key === 'Enter')) {
event.stopPropagation();
event.preventDefault();
this.handleSubmit.apply(this, arguments);
}
}
};
AvForm.prototype.render = function render() {
var _props = this.props;
var Tag = _props.tag;
var errorMessage = _props.errorMessage;
var model = _props.model;
var onValidSubmit = _props.onValidSubmit;
var onInvalidSubmit = _props.onInvalidSubmit;
var validate = _props.validate;
var validateOne = _props.validateOne;
var validateAll = _props.validateAll;
var validationEvent = _props.validationEvent;
var omit1 = _props.errorMessage;
var omit2 = _props.model;
var omit3 = _props.onValidSubmit;
var omit4 = _props.onInvalidSubmit;
var omit5 = _props.validate;
var omit6 = _props.validateOne;
var omit7 = _props.validateAll;
var omit8 = _props.validationEvent;
var className = _props.className;

@@ -164,10 +207,11 @@

className: classes,
onSubmit: this.handleSubmit }));
onSubmit: this.handleSubmit
}));
};
AvForm.prototype.getValues = function getValues() {
var _this2 = this;
var _this3 = this;
return Object.keys(this._inputs).reduce(function (values, inputName) {
(0, _lodash4.default)(values, inputName, _this2.getValue(inputName));
(0, _lodash4.default)(values, inputName, _this3.getValue(inputName));

@@ -183,6 +227,6 @@ return values;

AvForm.prototype.reset = function reset() {
var _this3 = this;
var _this4 = this;
Object.keys(this._inputs).forEach(function (inputName) {
return _this3._inputs[inputName].reset();
return _this4._inputs[inputName].reset();
});

@@ -196,9 +240,10 @@ };

AvForm.prototype.getInputState = function getInputState(inputName) {
var errorMessage = this.isTouched(inputName) && this.hasError(inputName);
var error = !!errorMessage;
var errorMessage = void 0;
var error = this.isTouched(inputName) && this.hasError(inputName);
var color = void 0;
if (error) {
errorMessage = this.state.invalidInputs[inputName];
color = 'danger';
if (errorMessage === true) {
if (!(0, _lodash6.default)(errorMessage)) {
errorMessage = 'This field is invalid';

@@ -307,7 +352,7 @@ }

AvForm.prototype.validateOne = function () {
var _ref = _asyncToGenerator(regeneratorRuntime.mark(function _callee(inputName, context) {
var _ref3 = _asyncToGenerator(regeneratorRuntime.mark(function _callee2(inputName, context) {
var input, value, validate, isValid, result, error;
return regeneratorRuntime.wrap(function _callee$(_context) {
return regeneratorRuntime.wrap(function _callee2$(_context2) {
while (1) {
switch (_context.prev = _context.next) {
switch (_context2.prev = _context2.next) {
case 0:

@@ -317,3 +362,3 @@ input = this._inputs[inputName];

if (!Array.isArray(input)) {
_context.next = 3;
_context2.next = 3;
break;

@@ -332,12 +377,12 @@ }

if (!(typeof validate === 'function')) {
_context.next = 14;
_context2.next = 14;
break;
}
_context.next = 11;
_context2.next = 11;
return validate(value, context, input);
case 11:
result = _context.sent;
_context.next = 21;
result = _context2.sent;
_context2.next = 21;
break;

@@ -347,12 +392,12 @@

if (!((typeof validate === 'undefined' ? 'undefined' : _typeof(validate)) === 'object')) {
_context.next = 20;
_context2.next = 20;
break;
}
_context.next = 17;
_context2.next = 17;
return this._validators[inputName](value, context);
case 17:
result = _context.sent;
_context.next = 21;
result = _context2.sent;
_context2.next = 21;
break;

@@ -375,14 +420,14 @@

return _context.abrupt('return', isValid);
return _context2.abrupt('return', isValid);
case 24:
case 'end':
return _context.stop();
return _context2.stop();
}
}
}, _callee, this);
}, _callee2, this);
}));
function validateOne(_x6, _x7) {
return _ref.apply(this, arguments);
function validateOne(_x7, _x8) {
return _ref3.apply(this, arguments);
}

@@ -394,30 +439,30 @@

AvForm.prototype.validateAll = function () {
var _ref2 = _asyncToGenerator(regeneratorRuntime.mark(function _callee2(context) {
var _ref4 = _asyncToGenerator(regeneratorRuntime.mark(function _callee3(context) {
var errors, isValid, inputName, valid, formLevelValidation;
return regeneratorRuntime.wrap(function _callee2$(_context2) {
return regeneratorRuntime.wrap(function _callee3$(_context3) {
while (1) {
switch (_context2.prev = _context2.next) {
switch (_context3.prev = _context3.next) {
case 0:
errors = [];
isValid = true;
_context2.t0 = regeneratorRuntime.keys(this._inputs);
_context3.t0 = regeneratorRuntime.keys(this._inputs);
case 3:
if ((_context2.t1 = _context2.t0()).done) {
_context2.next = 12;
if ((_context3.t1 = _context3.t0()).done) {
_context3.next = 12;
break;
}
inputName = _context2.t1.value;
inputName = _context3.t1.value;
if (!this._inputs.hasOwnProperty(inputName)) {
_context2.next = 10;
_context3.next = 10;
break;
}
_context2.next = 8;
_context3.next = 8;
return this.validateOne(inputName, context);
case 8:
valid = _context2.sent;
valid = _context3.sent;

@@ -430,3 +475,3 @@ if (!valid) {

case 10:
_context2.next = 3;
_context3.next = 3;
break;

@@ -451,3 +496,3 @@

return _context2.abrupt('return', {
return _context3.abrupt('return', {
isValid: isValid,

@@ -459,10 +504,10 @@ errors: errors

case 'end':
return _context2.stop();
return _context3.stop();
}
}
}, _callee2, this);
}, _callee3, this);
}));
function validateAll(_x8) {
return _ref2.apply(this, arguments);
function validateAll(_x9) {
return _ref4.apply(this, arguments);
}

@@ -474,18 +519,18 @@

AvForm.prototype.compileValidationRules = function compileValidationRules(input, ruleProp) {
var _this4 = this;
var _this5 = this;
return function () {
var _ref3 = _asyncToGenerator(regeneratorRuntime.mark(function _callee3(val, context) {
var _ref5 = _asyncToGenerator(regeneratorRuntime.mark(function _callee4(val, context) {
var result, validations, _loop, rule;
return regeneratorRuntime.wrap(function _callee3$(_context3) {
return regeneratorRuntime.wrap(function _callee4$(_context4) {
while (1) {
switch (_context3.prev = _context3.next) {
switch (_context4.prev = _context4.next) {
case 0:
if (!_this4.isBad(input.props.name)) {
_context3.next = 2;
if (!_this5.isBad(input.props.name)) {
_context4.next = 2;
break;
}
return _context3.abrupt('return', false);
return _context4.abrupt('return', false);

@@ -522,3 +567,3 @@ case 2:

} else {
//they are using the callback
// they are using the callback
}

@@ -536,7 +581,7 @@ });

_context3.next = 8;
_context4.next = 8;
return Promise.all(validations).then(function (results) {
results.every(function (ruleResult) {
if (result === true && ruleResult.value !== true) {
result = (0, _lodash6.default)(ruleResult.value) && ruleResult.value || getInputErrorMessage(input, ruleResult.rule) || getInputErrorMessage(_this4, ruleResult.rule) || false;
result = (0, _lodash6.default)(ruleResult.value) && ruleResult.value || getInputErrorMessage(input, ruleResult.rule) || getInputErrorMessage(_this5, ruleResult.rule) || false;
}

@@ -548,14 +593,14 @@ return result === true;

case 8:
return _context3.abrupt('return', result);
return _context4.abrupt('return', result);
case 9:
case 'end':
return _context3.stop();
return _context4.stop();
}
}
}, _callee3, _this4);
}, _callee4, _this5);
}));
return function (_x9, _x10) {
return _ref3.apply(this, arguments);
return function (_x10, _x11) {
return _ref5.apply(this, arguments);
};

@@ -579,50 +624,2 @@ }();

AvForm.prototype.handleSubmit = function () {
var _ref4 = _asyncToGenerator(regeneratorRuntime.mark(function _callee4(e) {
var values, _ref5, isValid, errors;
return regeneratorRuntime.wrap(function _callee4$(_context4) {
while (1) {
switch (_context4.prev = _context4.next) {
case 0:
if (e && typeof e.preventDefault === 'function') {
e.preventDefault();
}
values = this.getValues();
_context4.next = 4;
return this.validateAll(values);
case 4:
_ref5 = _context4.sent;
isValid = _ref5.isValid;
errors = _ref5.errors;
this.setTouched(Object.keys(this._inputs));
this.props.onSubmit(e, errors, values);
if (isValid) {
this.props.onValidSubmit(e, values);
} else {
this.props.onInvalidSubmit(e, errors, values);
}
!this.state.submitted && this.setState({ submitted: true });
case 11:
case 'end':
return _context4.stop();
}
}
}, _callee4, this);
}));
function handleSubmit(_x11) {
return _ref4.apply(this, arguments);
}
return handleSubmit;
}();
return AvForm;

@@ -629,0 +626,0 @@ }(_AvInputContainer2.default);

@@ -42,6 +42,6 @@ 'use strict';

var _props = this.props;
var errorMessage = _props.errorMessage;
var validate = _props.validate;
var validationEvent = _props.validationEvent;
var state = _props.state;
var omit1 = _props.errorMessage;
var omit2 = _props.validate;
var omit3 = _props.validationEvent;
var omit4 = _props.state;
var className = _props.className;

@@ -48,0 +48,0 @@ var Tag = _props.tag;

@@ -13,2 +13,13 @@ 'use strict';

function validComponent(input) {
var type = input && input.props ? input.props.type : undefined;
var name = input && input.props ? input.props.name : undefined;
if (!name) {
throw new Error('Input ' + input + ' has no "name" prop');
}
return { type: type, name: name };
}
var InputContainer = function (_Component) {

@@ -63,14 +74,2 @@ _inherits(InputContainer, _Component);

exports.default = InputContainer;
function validComponent(input) {
var type = input && input.props ? input.props.type : undefined;
var name = input && input.props ? input.props.name : undefined;
if (!name) {
throw new Error('Input ' + input + ' has no "name" prop');
}
return { type: type, name: name };
}
exports.default = InputContainer;

@@ -27,2 +27,2 @@ 'use strict';

return date.isValid() || errorMessage;
};
}

@@ -14,2 +14,26 @@ 'use strict';

function setMin(value) {
value.set('hours', 0);
value.set('minutes', 0);
value.set('seconds', 0);
return value;
}
function setMax(value) {
value.set('hours', 23);
value.set('minutes', 59);
value.set('seconds', 59);
return value;
}
function getStartDate(start) {
return setMin((0, _moment2.default)().add(start.value, start.units));
}
function getEndDate(end) {
return setMax((0, _moment2.default)().add(end.value, end.units));
}
function validate(value, context) {

@@ -45,26 +69,2 @@ var _ref = arguments.length <= 2 || arguments[2] === undefined ? {} : arguments[2];

return date.isValid() && (date.isBetween(startDate, endDate, 'day') || date.isSame(startDate, 'day') || date.isSame(endDate, 'day')) || errorMessage;
};
function getStartDate(start) {
return setMin((0, _moment2.default)().add(start.value, start.units));
}
function getEndDate(end) {
return setMax((0, _moment2.default)().add(end.value, end.units));
}
function setMin(value) {
value.set('hours', 0);
value.set('minutes', 0);
value.set('seconds', 0);
return value;
}
function setMax(value) {
value.set('hours', 23);
value.set('minutes', 59);
value.set('seconds', 59);
return value;
}

@@ -23,2 +23,2 @@ 'use strict';

return (0, _pattern2.default)(value, context, { value: pattern, errorMessage: errorMessage });
};
}

@@ -12,2 +12,2 @@ 'use strict';

return (0, _utils.isEmpty)(value) || value === context[constraint.value] || constraint.errorMessage || false;
};
}

@@ -31,2 +31,2 @@ 'use strict';

return !isNaN(number) && isFinite(number) && number <= (0, _lodash2.default)(constraint.value) || constraint.errorMessage || false;
};
}

@@ -22,2 +22,2 @@ 'use strict';

return length <= (0, _lodash2.default)(constraint.value) || constraint.errorMessage || false;
};
}

@@ -31,2 +31,2 @@ 'use strict';

return !isNaN(number) && isFinite(number) && number >= (0, _lodash2.default)(constraint.value) || constraint.errorMessage || false;
};
}

@@ -22,2 +22,2 @@ 'use strict';

return length >= (0, _lodash2.default)(constraint.value) || constraint.errorMessage || false;
};
}

@@ -52,2 +52,2 @@ 'use strict';

return calculatedCheck === digit || errorMessage;
};
}

@@ -29,2 +29,2 @@ 'use strict';

return (0, _lodash2.default)(number) && !isNaN(number) || errorMessage;
};
}

@@ -16,14 +16,2 @@ 'use strict';

function validate(value, context) {
var constraint = arguments.length <= 2 || arguments[2] === undefined ? {} : arguments[2];
if ((0, _utils.isEmpty)(value)) return true;
var values = Array.isArray(constraint.value) ? constraint.value : [constraint.value];
return values.some(function (expression) {
return asRegExp(expression).test(value);
}) || constraint.errorMessage || false;
}
function asRegExp(pattern) {

@@ -42,2 +30,14 @@ // if regex then return it

return new RegExp(pattern);
}
function validate(value, context) {
var constraint = arguments.length <= 2 || arguments[2] === undefined ? {} : arguments[2];
if ((0, _utils.isEmpty)(value)) return true;
var values = Array.isArray(constraint.value) ? constraint.value : [constraint.value];
return values.some(function (expression) {
return asRegExp(expression).test(value);
}) || constraint.errorMessage || false;
}

@@ -23,2 +23,2 @@ 'use strict';

return (0, _pattern2.default)(value, context, { value: pattern, errorMessage: errorMessage });
};
}

@@ -15,2 +15,2 @@ 'use strict';

return !(0, _utils.isEmpty)(value) || errorMessage || false;
};
}

@@ -14,2 +14,12 @@ 'use strict';

// http://stackoverflow.com/a/31711034/1873485
function floatSafeRemainder(val, step) {
var valDecCount = (val.toString().split('.')[1] || '').length;
var stepDecCount = (step.toString().split('.')[1] || '').length;
var decCount = valDecCount > stepDecCount ? valDecCount : stepDecCount;
var valInt = parseInt(val.toFixed(decCount).replace('.', ''), 10);
var stepInt = parseInt(step.toFixed(decCount).replace('.', ''), 10);
return valInt % stepInt / Math.pow(10, decCount);
}
function validate(value, context) {

@@ -21,12 +31,2 @@ var constraint = arguments.length <= 2 || arguments[2] === undefined ? {} : arguments[2];

return floatSafeRemainder((0, _lodash2.default)(value), (0, _lodash2.default)(constraint.value)) === 0 || constraint.errorMessage || false;
};
// http://stackoverflow.com/a/31711034/1873485
function floatSafeRemainder(val, step) {
var valDecCount = (val.toString().split('.')[1] || '').length;
var stepDecCount = (step.toString().split('.')[1] || '').length;
var decCount = valDecCount > stepDecCount ? valDecCount : stepDecCount;
var valInt = parseInt(val.toFixed(decCount).replace('.', ''));
var stepInt = parseInt(step.toFixed(decCount).replace('.', ''));
return valInt % stepInt / Math.pow(10, decCount);
}

@@ -1,2 +0,2 @@

"use strict";
'use strict';

@@ -6,3 +6,3 @@ exports.__esModule = true;

var _pattern = require("./pattern");
var _pattern = require('./pattern');

@@ -14,10 +14,10 @@ var _pattern2 = _interopRequireDefault(_pattern);

// https://gist.github.com/dperini/729294
var URL_REGEXP = new RegExp("^" +
var URL_REGEXP = new RegExp('^' +
// protocol identifier
"(?:(?:https?|ftps?|sftp)://)" +
'(?:(?:https?|ftps?|sftp)://)' +
// user:pass authentication
"(?:\\S+(?::\\S*)?@)?" + "(?:" +
'(?:\\S+(?::\\S*)?@)?' + '(?:' +
// IP address exclusion
// private & local networks
"(?!(?:10|127)(?:\\.\\d{1,3}){3})" + "(?!(?:169\\.254|192\\.168)(?:\\.\\d{1,3}){2})" + "(?!172\\.(?:1[6-9]|2\\d|3[0-1])(?:\\.\\d{1,3}){2})" +
'(?!(?:10|127)(?:\\.\\d{1,3}){3})' + '(?!(?:169\\.254|192\\.168)(?:\\.\\d{1,3}){2})' + '(?!172\\.(?:1[6-9]|2\\d|3[0-1])(?:\\.\\d{1,3}){2})' +
// IP address dotted notation octets

@@ -28,15 +28,15 @@ // excludes loopback network 0.0.0.0

// (first & last IP address of each class)
"(?:[1-9]\\d?|1\\d\\d|2[01]\\d|22[0-3])" + "(?:\\.(?:1?\\d{1,2}|2[0-4]\\d|25[0-5])){2}" + "(?:\\.(?:[1-9]\\d?|1\\d\\d|2[0-4]\\d|25[0-4]))" + "|" +
'(?:[1-9]\\d?|1\\d\\d|2[01]\\d|22[0-3])' + '(?:\\.(?:1?\\d{1,2}|2[0-4]\\d|25[0-5])){2}' + '(?:\\.(?:[1-9]\\d?|1\\d\\d|2[0-4]\\d|25[0-4]))' + '|' +
// host name
"(?:(?:[a-z\\u00a1-\\uffff0-9]-*)*[a-z\\u00a1-\\uffff0-9]+)" +
'(?:(?:[a-z\\u00a1-\\uffff0-9]-*)*[a-z\\u00a1-\\uffff0-9]+)' +
// domain name
"(?:\\.(?:[a-z\\u00a1-\\uffff0-9]-*)*[a-z\\u00a1-\\uffff0-9]+)*" +
'(?:\\.(?:[a-z\\u00a1-\\uffff0-9]-*)*[a-z\\u00a1-\\uffff0-9]+)*' +
// TLD identifier
"(?:\\.(?:[a-z\\u00a1-\\uffff]{2,}))" +
'(?:\\.(?:[a-z\\u00a1-\\uffff]{2,}))' +
// TLD may end with dot
"\\.?" + ")" +
'\\.?' + ')' +
// port number
"(?::\\d{2,5})?" +
'(?::\\d{2,5})?' +
// resource path
"(?:[/?#]\\S*)?" + "$", "i");
'(?:[/?#]\\S*)?' + '$', 'i');

@@ -52,2 +52,2 @@ function validate(value, context) {

return (0, _pattern2.default)(value, context, { value: pattern, errorMessage: errorMessage });
};
}

@@ -17,2 +17,3 @@ 'use strict';

/* global document */
var isoDateFormat = exports.isoDateFormat = 'YYYY-MM-DD';

@@ -35,9 +36,11 @@

for (var i in inputType) {
tester.type = i;
tester.value = ':(';
if (inputType.hasOwnProperty(i)) {
tester.type = i;
tester.value = ':(';
if (tester.type === i && tester.value === '') {
inputType[i] = true;
if (tester.type === i && tester.value === '') {
inputType[i] = true;
}
}
}
}
'use strict';
exports.__esModule = true;
exports.AvValidator = exports.AvInputContainer = exports.AvBaseInput = exports.AvInput = exports.AvGroup = exports.AvForm = exports.AvField = exports.AvFeedback = undefined;
exports.AvValidator = exports.AvInputContainer = exports.AvBaseInput = exports.AvInput = exports.AvRadio = exports.AvRadioGroup = exports.AvGroup = exports.AvForm = exports.AvField = exports.AvFeedback = undefined;

@@ -24,2 +24,10 @@ require('babel-polyfill');

var _AvRadioGroup = require('./AvRadioGroup');
var _AvRadioGroup2 = _interopRequireDefault(_AvRadioGroup);
var _AvRadio = require('./AvRadio');
var _AvRadio2 = _interopRequireDefault(_AvRadio);
var _AvInput = require('./AvInput');

@@ -47,2 +55,4 @@

exports.AvGroup = _AvGroup2.default;
exports.AvRadioGroup = _AvRadioGroup2.default;
exports.AvRadio = _AvRadio2.default;
exports.AvInput = _AvInput2.default;

@@ -49,0 +59,0 @@ exports.AvBaseInput = _AvBaseInput2.default;

{
"name": "availity-reactstrap-validation",
"version": "1.1.1",
"version": "1.2.0",
"author": "Evan Sharp <evan.sharp@availity.com>",

@@ -12,3 +12,4 @@ "description": "Form validation helpers for reactstrap",

"scripts": {
"ci": "cross-env BABEL_ENV=test nyc mocha-webpack && coveralls < ./__test__/coverage/lcov.info",
"ci": "npm run lint && cross-env BABEL_ENV=test nyc mocha-webpack",
"report-coverage": "coveralls < ./__test__/coverage/lcov.info",
"test:coverage": "cross-env BABEL_ENV=test nyc mocha-webpack && npm run cleanup",

@@ -22,2 +23,3 @@ "test": "mocha-webpack && npm run cleanup",

"prebuild": "babel src --out-dir lib",
"lint": "eslint src",
"create-release": "npm test && sh ./scripts/release",

@@ -84,3 +86,3 @@ "publish-release": "npm test && sh ./scripts/publish"

"babel-register": "^6.11.6",
"bootstrap": "^4.0.0-alpha.3",
"bootstrap": "^4.0.0-alpha.4",
"chai": "^3.5.0",

@@ -87,0 +89,0 @@ "chai-as-promised": "^5.3.0",

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

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