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

@yamada-ui/utils

Package Overview
Dependencies
Maintainers
0
Versions
506
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@yamada-ui/utils - npm Package Compare versions

Comparing version 1.4.1-next-20240908154823 to 1.5.0-dev-20240910061033

dist/chunk-3TVQXHA7.mjs

2

dist/index.d.ts
export { Dict, Length, Merge, MergeIfDefined, ObjectLiteral, Path, Primitive, StringLiteral, Union } from './index.types.js';
export { cast, is, isArray, isBoolean, isEmpty, isFunction, isNotNumber, isNull, isNumber, isNumeric, isObject, isString, isUndefined, isUnit } from './assertion.js';
export { assignAfter, filterObject, filterUndefined, flattenObject, getMemoizedObject, getObject, keysFormObject, memoizeObject, merge, objectFromEntries, omitObject, pickObject, replaceObject, splitObject } from './object.js';
export { FlattenObjectOptions, assignAfter, filterObject, filterUndefined, flattenObject, getMemoizedObject, getObject, keysFormObject, memoizeObject, merge, objectFromEntries, omitObject, pickObject, replaceObject, splitObject } from './object.js';
export { funcAll, handlerAll, noop, runIfFunc } from './function.js';

@@ -5,0 +5,0 @@ export { AsyncFnReturn, AsyncState, AsyncStateRetry, DOMAttributes, FunctionReturningPromise, MaybeRenderProp, PromiseType, PropGetter, RequiredPropGetter, UseIsMountedProps, UseIsMountedReturn, assignRef, createContext, createId, cx, findChildren, getValidChildren, includesChildren, isRefObject, isValidElement, mergeRefs, omitChildren, pickChildren, useAsync, useAsyncFunc, useAsyncRetry, useCallbackRef, useIsMounted, useMergeRefs, useSafeLayoutEffect, useUnmountEffect, useUpdateEffect } from './react.js';

@@ -261,11 +261,19 @@ "use strict";

};
var flattenObject = (obj, maxDepth = Infinity, omitKeys = []) => {
var flattenObject = (obj, { maxDepth, omitKeys, separator, shouldProcess } = {}) => {
maxDepth != null ? maxDepth : maxDepth = Infinity;
omitKeys != null ? omitKeys : omitKeys = [];
separator != null ? separator : separator = ".";
if (!isObject(obj) && !isArray(obj) || !maxDepth) return obj;
return Object.entries(obj).reduce((result, [key, value]) => {
if (isObject(value) && !Object.keys(value).some((key2) => omitKeys.includes(key2))) {
Object.entries(flattenObject(value, maxDepth - 1, omitKeys)).forEach(
([childKey, childValue]) => {
result[`${key}.${childKey}`] = childValue;
}
);
if (isObject(value) && !Object.keys(value).some((key2) => omitKeys == null ? void 0 : omitKeys.includes(key2)) && (!shouldProcess || shouldProcess(value))) {
Object.entries(
flattenObject(value, {
maxDepth: maxDepth - 1,
omitKeys,
separator,
shouldProcess
})
).forEach(([childKey, childValue]) => {
result[`${key}${separator}${childKey}`] = childValue;
});
} else {

@@ -272,0 +280,0 @@ result[key] = value;

@@ -9,3 +9,9 @@ import { Dict } from './index.types.js';

declare const merge: <Y extends Dict>(target: any, source: any, mergeArray?: boolean) => Y;
declare const flattenObject: <Y extends Dict>(obj: any, maxDepth?: number, omitKeys?: string[]) => Y;
type FlattenObjectOptions = {
maxDepth?: number;
omitKeys?: string[];
separator?: string;
shouldProcess?: (obj: any) => boolean;
};
declare const flattenObject: <Y extends Dict>(obj: any, { maxDepth, omitKeys, separator, shouldProcess }?: FlattenObjectOptions) => Y;
declare const objectFromEntries: <Y extends Dict>(entries: any[][]) => Y;

@@ -19,2 +25,2 @@ declare const keysFormObject: <Y extends Dict>(obj: Y) => (keyof Y)[];

export { assignAfter, filterObject, filterUndefined, flattenObject, getMemoizedObject, getObject, keysFormObject, memoizeObject, merge, objectFromEntries, omitObject, pickObject, replaceObject, splitObject };
export { type FlattenObjectOptions, assignAfter, filterObject, filterUndefined, flattenObject, getMemoizedObject, getObject, keysFormObject, memoizeObject, merge, objectFromEntries, omitObject, pickObject, replaceObject, splitObject };

@@ -124,11 +124,19 @@ "use strict";

};
var flattenObject = (obj, maxDepth = Infinity, omitKeys = []) => {
var flattenObject = (obj, { maxDepth, omitKeys, separator, shouldProcess } = {}) => {
maxDepth != null ? maxDepth : maxDepth = Infinity;
omitKeys != null ? omitKeys : omitKeys = [];
separator != null ? separator : separator = ".";
if (!isObject(obj) && !isArray(obj) || !maxDepth) return obj;
return Object.entries(obj).reduce((result, [key, value]) => {
if (isObject(value) && !Object.keys(value).some((key2) => omitKeys.includes(key2))) {
Object.entries(flattenObject(value, maxDepth - 1, omitKeys)).forEach(
([childKey, childValue]) => {
result[`${key}.${childKey}`] = childValue;
}
);
if (isObject(value) && !Object.keys(value).some((key2) => omitKeys == null ? void 0 : omitKeys.includes(key2)) && (!shouldProcess || shouldProcess(value))) {
Object.entries(
flattenObject(value, {
maxDepth: maxDepth - 1,
omitKeys,
separator,
shouldProcess
})
).forEach(([childKey, childValue]) => {
result[`${key}${separator}${childKey}`] = childValue;
});
} else {

@@ -135,0 +143,0 @@ result[key] = value;

{
"name": "@yamada-ui/utils",
"version": "1.4.1-next-20240908154823",
"version": "1.5.0-dev-20240910061033",
"description": "Yamada UI utils",

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

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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