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

@hyeon/react-use

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@hyeon/react-use - npm Package Compare versions

Comparing version 0.0.9 to 0.0.10

dist/packages/useDeepMerge/index.d.ts

1

dist/index.d.ts
export * from './packages/useRemoveSpaceProgramming';
export * from './packages/useDeepMerge';

@@ -6,2 +6,3 @@ import { pipe } from 'fp-ts/lib/function';

import { useState, useCallback } from 'react';
import { pipe as pipe$1 } from 'fp-ts/function';

@@ -32,3 +33,27 @@ // 이 hook에서 메인이 되는 함수이다.

export { obj2keyMap, useObj2KeyMap, useRSP, useRemoveSpaceProgramming };
const isObject = obj => obj !== null && typeof obj === 'object';
const deepMerge = source => target => {
let output = Object.assign({}, source);
if (isObject(source) && isObject(target)) {
if (Array.isArray(source) && Array.isArray(target)) {
output = [...source, ...target];
} else {
Object.keys(target).forEach(key => {
if (isObject(source[key]) && isObject(target[key])) {
output[key] = deepMerge(source[key])(target[key]);
} else {
output[key] = target[key];
}
});
}
}
return output;
};
const useDeepMerge = (obj, merge) => {
const [value, setValue] = useState(pipe$1(obj, deepMerge(merge)));
const setDeppMerge = useCallback(tree => setValue(tree), [setValue]);
return [value, setDeppMerge];
};
export { deepMerge, obj2keyMap, useDeepMerge, useObj2KeyMap, useRSP, useRemoveSpaceProgramming };
//# sourceMappingURL=index.esm.js.map

2

package.json
{
"name": "@hyeon/react-use",
"version": "0.0.9",
"version": "0.0.10",
"type": "module",

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

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