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

@britannica/react-hooks

Package Overview
Dependencies
Maintainers
4
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@britannica/react-hooks - npm Package Compare versions

Comparing version 0.2.7 to 0.2.8

39

dist/bundle.js/index.js
import { bindActionCreators } from 'redux';
import { useDispatch } from 'react-redux';
import { useMemo, useState, useEffect } from 'react';
function useActions(actions, deps, dispatch) {
// const dispatch = useDispatch();
function useActions(actions, deps) {
const dispatch = useDispatch();
return useMemo(() => {

@@ -143,2 +144,34 @@ if (Array.isArray(actions)) {

export { useActions, useForm };
/**
* Map a `yup` ValidationError object to individual form fields
* e.g.
* {
* field1: [
* 'Error message 1',
* 'Error message 2',
* ],
* field2: [
* 'Error message 3',
* ],
* }
*
* @param {ValidationError} validationError
* @returns {object}
*/
const mapValidationErrorToFormFields = validationError => {
if (!validationError.inner) {
return {};
}
const errors = {};
validationError.inner.forEach(error => {
if (!errors[error.params.path]) {
errors[error.params.path] = [];
}
errors[error.params.path].push(error.message);
});
return errors;
};
export { mapValidationErrorToFormFields, useActions, useForm };

4

package.json
{
"name": "@britannica/react-hooks",
"version": "0.2.7",
"version": "0.2.8",
"description": "",

@@ -40,3 +40,3 @@ "main": "dist/bundle.js",

"redux": "~4.0.1",
"react-redux": "~7.0.3"
"react-redux": "^7.1.0-alpha.4"
},

@@ -43,0 +43,0 @@ "browserslist": [

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