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

react-use-validator

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-use-validator - npm Package Compare versions

Comparing version 1.0.1 to 1.0.2

2

dist/index.js

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

"use strict";var _exportNames={ignoreValidatorError:!0};Object.defineProperty(exports,"__esModule",{value:!0});exports.ignoreValidatorError=ignoreValidatorError,exports.default=_default;var _react=require("react"),_validatorCreator=require("validator-creator");Object.keys(_validatorCreator).forEach(function(a){"default"===a||"__esModule"===a||Object.prototype.hasOwnProperty.call(_exportNames,a)||Object.defineProperty(exports,a,{enumerable:!0,get:function b(){return _validatorCreator[a]}})});function _toConsumableArray(a){return _arrayWithoutHoles(a)||_iterableToArray(a)||_nonIterableSpread()}function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance")}function _iterableToArray(a){if(Symbol.iterator in Object(a)||"[object Arguments]"===Object.prototype.toString.call(a))return Array.from(a)}function _arrayWithoutHoles(a){if(Array.isArray(a)){for(var b=0,c=Array(a.length);b<a.length;b++)c[b]=a[b];return c}}function asyncGeneratorStep(a,b,c,d,e,f,g){try{var h=a[f](g),i=h.value}catch(a){return void c(a)}h.done?b(i):Promise.resolve(i).then(d,e)}function _asyncToGenerator(a){return function(){var b=this,c=arguments;return new Promise(function(d,e){function f(a){asyncGeneratorStep(h,d,e,f,g,"next",a)}function g(a){asyncGeneratorStep(h,d,e,f,g,"throw",a)}var h=a.apply(b,c);f(void 0)})}}function _slicedToArray(a,b){return _arrayWithHoles(a)||_iterableToArrayLimit(a,b)||_nonIterableRest()}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}function _iterableToArrayLimit(a,b){var c=[],d=!0,e=!1,f=void 0;try{for(var g,h=a[Symbol.iterator]();!(d=(g=h.next()).done)&&(c.push(g.value),!(b&&c.length===b));d=!0);}catch(a){e=!0,f=a}finally{try{d||null==h["return"]||h["return"]()}finally{if(e)throw f}}return c}function _arrayWithHoles(a){if(Array.isArray(a))return a}function _objectSpread(a){for(var b=1;b<arguments.length;b++){var c=null==arguments[b]?{}:arguments[b],d=Object.keys(c);"function"==typeof Object.getOwnPropertySymbols&&(d=d.concat(Object.getOwnPropertySymbols(c).filter(function(a){return Object.getOwnPropertyDescriptor(c,a).enumerable}))),d.forEach(function(b){_defineProperty(a,b,c[b])})}return a}function _defineProperty(a,b,c){return b in a?Object.defineProperty(a,b,{value:c,enumerable:!0,configurable:!0,writable:!0}):a[b]=c,a}var initialState={},initialChanges={};function merge(){for(var a={},b=arguments.length,c=Array(b),d=0;d<b;d++)c[d]=arguments[d];for(var e,f=0;f<c.length;f++)e=c[f],a=_objectSpread({},a,Object.entries(e).reduce(function(a,b){var c=_slicedToArray(b,2),d=c[0],e=c[1];return null===e?a:_objectSpread({},a,_defineProperty({},d,e))},{}));return a}function update(a,b){return new Promise(function(c){return a(function(a){var d=_objectSpread({},a,b);return c(d),d})})}function ignoreValidatorError(a){if(!(a instanceof _validatorCreator.ValidatorError))throw a}function _default(a){var b=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},c=(0,_react.useState)(initialState),d=_slicedToArray(c,2),e=d[0],f=d[1],g=(0,_react.useState)(initialState),h=_slicedToArray(g,2),i=h[0],j=h[1],k=(0,_react.useState)(initialChanges),l=_slicedToArray(k,2),m=l[1],n=(0,_react.useMemo)(function(){return(0,_validatorCreator.createValidator)(a)},[]),o=(0,_react.useMemo)(function(){return(0,_validatorCreator.createValidator)(b)},[]),p=(0,_react.useMemo)(function(){return merge(e,i)},[e,i]),q=function(){var a=_asyncToGenerator(regeneratorRuntime.mark(function a(){var b,c,d,e,g,h,i,k=arguments;return regeneratorRuntime.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return b=0<k.length&&void 0!==k[0]?k[0]:null,a.next=3,update(m,b);case 3:for(c=a.sent,d=k.length,e=Array(1<d?d-1:0),g=1;g<d;g++)e[g-1]=k[g];return a.next=7,n.apply(void 0,[b].concat(e)).then(_validatorCreator.getPayload);case 7:return h=a.sent,a.next=10,o.apply(void 0,[c].concat(e)).then(_validatorCreator.getPayload);case 10:return i=a.sent,a.t0=merge,a.t1=void 0,a.t2=_toConsumableArray,a.next=16,Promise.all([update(f,h),update(j,i)]);case 16:return a.t3=a.sent,a.t4=(0,a.t2)(a.t3),a.abrupt("return",a.t0.apply.call(a.t0,a.t1,a.t4));case 19:case"end":return a.stop();}},a,this)}));return function(){return a.apply(this,arguments)}}();return q.reset=function(){f(initialState),j(initialState),m(initialChanges)},[p,q]}
"use strict";var _exportNames={ignoreValidatorError:!0};Object.defineProperty(exports,"__esModule",{value:!0});exports.ignoreValidatorError=ignoreValidatorError,exports.default=_default;var _react=require("react"),_validatorCreator=require("validator-creator");Object.keys(_validatorCreator).forEach(function(a){"default"===a||"__esModule"===a||Object.prototype.hasOwnProperty.call(_exportNames,a)||Object.defineProperty(exports,a,{enumerable:!0,get:function b(){return _validatorCreator[a]}})});function _toConsumableArray(a){return _arrayWithoutHoles(a)||_iterableToArray(a)||_nonIterableSpread()}function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance")}function _iterableToArray(a){if(Symbol.iterator in Object(a)||"[object Arguments]"===Object.prototype.toString.call(a))return Array.from(a)}function _arrayWithoutHoles(a){if(Array.isArray(a)){for(var b=0,c=Array(a.length);b<a.length;b++)c[b]=a[b];return c}}function asyncGeneratorStep(a,b,c,d,e,f,g){try{var h=a[f](g),i=h.value}catch(a){return void c(a)}h.done?b(i):Promise.resolve(i).then(d,e)}function _asyncToGenerator(a){return function(){var b=this,c=arguments;return new Promise(function(d,e){function f(a){asyncGeneratorStep(h,d,e,f,g,"next",a)}function g(a){asyncGeneratorStep(h,d,e,f,g,"throw",a)}var h=a.apply(b,c);f(void 0)})}}function _slicedToArray(a,b){return _arrayWithHoles(a)||_iterableToArrayLimit(a,b)||_nonIterableRest()}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}function _iterableToArrayLimit(a,b){var c=[],d=!0,e=!1,f=void 0;try{for(var g,h=a[Symbol.iterator]();!(d=(g=h.next()).done)&&(c.push(g.value),!(b&&c.length===b));d=!0);}catch(a){e=!0,f=a}finally{try{d||null==h["return"]||h["return"]()}finally{if(e)throw f}}return c}function _arrayWithHoles(a){if(Array.isArray(a))return a}function _objectSpread(a){for(var b=1;b<arguments.length;b++){var c=null==arguments[b]?{}:arguments[b],d=Object.keys(c);"function"==typeof Object.getOwnPropertySymbols&&(d=d.concat(Object.getOwnPropertySymbols(c).filter(function(a){return Object.getOwnPropertyDescriptor(c,a).enumerable}))),d.forEach(function(b){_defineProperty(a,b,c[b])})}return a}function _defineProperty(a,b,c){return b in a?Object.defineProperty(a,b,{value:c,enumerable:!0,configurable:!0,writable:!0}):a[b]=c,a}var initialState={},initialChanges={},defaultOptions={delay:0};function merge(){for(var a={},b=arguments.length,c=Array(b),d=0;d<b;d++)c[d]=arguments[d];for(var e,f=0;f<c.length;f++)e=c[f],a=_objectSpread({},a,Object.entries(e).reduce(function(a,b){var c=_slicedToArray(b,2),d=c[0],e=c[1];return null===e?a:_objectSpread({},a,_defineProperty({},d,e))},{}));return a}function update(a,b){return new Promise(function(c){return a(function(a){var d=_objectSpread({},a,b);return c(d),d})})}function ignoreValidatorError(a){if(!(a instanceof _validatorCreator.ValidatorError))throw a}function _default(a){var b=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},c=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{},d=_objectSpread({},defaultOptions,c),e=(0,_react.useState)(initialState),f=_slicedToArray(e,2),g=f[0],h=f[1],i=(0,_react.useState)(initialState),j=_slicedToArray(i,2),k=j[0],l=j[1],m=(0,_react.useState)(initialChanges),n=_slicedToArray(m,2),o=n[1],p=(0,_react.useMemo)(function(){return(0,_validatorCreator.createValidator)(a)},[]),q=(0,_react.useMemo)(function(){return(0,_validatorCreator.createValidator)(b)},[]),r=(0,_react.useMemo)(function(){return merge(g,k)},[g,k]),s=(0,_react.useState)(0),t=_slicedToArray(s,2),u=t[0],v=t[1],w=(0,_react.useState)({}),x=_slicedToArray(w,2),y=x[0],z=x[1];(0,_react.useEffect)(function(){if(!(0>u)){var a=setTimeout(function(){return z(r)},u);return function(){return clearTimeout(a)}}},[r,u]);var A=function(){var a=_asyncToGenerator(regeneratorRuntime.mark(function a(){var b,c,e,f,g,i,j,k,m=arguments;return regeneratorRuntime.wrap(function(a){var n=Math.max;for(;;)switch(a.prev=a.next){case 0:return b=0<m.length&&void 0!==m[0]?m[0]:null,c=Date.now(),v(-1),a.next=5,update(o,b);case 5:for(e=a.sent,f=m.length,g=Array(1<f?f-1:0),i=1;i<f;i++)g[i-1]=m[i];return a.next=9,p.apply(void 0,[b].concat(g)).then(_validatorCreator.getPayload);case 9:return j=a.sent,a.next=12,q.apply(void 0,[e].concat(g)).then(_validatorCreator.getPayload);case 12:return k=a.sent,v(null===b||1<g.length?0:n(0,d.delay-(Date.now()-c))),a.t0=merge,a.t1=void 0,a.t2=_toConsumableArray,a.next=19,Promise.all([update(h,j),update(l,k)]);case 19:return a.t3=a.sent,a.t4=(0,a.t2)(a.t3),a.abrupt("return",a.t0.apply.call(a.t0,a.t1,a.t4));case 22:case"end":return a.stop();}},a,this)}));return function(){return a.apply(this,arguments)}}();return A.reset=function(){h(initialState),l(initialState),o(initialChanges)},[y,A]}
{
"name": "react-use-validator",
"version": "1.0.1",
"version": "1.0.2",
"description": "A React Hook to handle form validation messages",

@@ -5,0 +5,0 @@ "keywords": [

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