@ehfuse/forma
Version:
Advanced React state management library with individual field subscriptions - supports both forms and general state management with useFormaState
58 lines • 2.82 kB
TypeScript
/**
* dotNotation.ts
*
* Forma - Dot notation 관련 유틸리티 함수들 | Dot notation utility functions
* 중첩 객체의 값을 안전하게 가져오고 설정하는 기능 제공 | Provides safe getting and setting of nested object values
*
* @license MIT License
* @copyright 2025 KIM YOUNG JIN (Kim Young Jin)
* @author KIM YOUNG JIN (ehfuse@gmail.com)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
/**
* dot notation으로 중첩 객체의 값을 가져오는 함수 | Function to get nested object values using dot notation
* @param obj 대상 객체 | Target object
* @param path dot notation 경로 (예: "user.profile.name") | Dot notation path (e.g., "user.profile.name")
* @returns 해당 경로의 값 또는 undefined | Value at the path or undefined
*
* @example
* ```typescript
* const data = { user: { profile: { name: 'John' } } };
* const name = getNestedValue(data, 'user.profile.name'); // 'John'
* ```
*/
export declare function getNestedValue(obj: any, path: string): any;
/**
* dot notation으로 중첩 객체의 값을 설정하는 함수 | Function to set nested object values using dot notation
* 불변성을 유지하면서 새로운 객체를 반환 | Returns a new object while maintaining immutability
* @param obj 대상 객체 | Target object
* @param path dot notation 경로 | Dot notation path
* @param value 설정할 값 | Value to set
* @returns 새로운 객체 | New object
*
* @example
* ```typescript
* const data = { user: { profile: { name: 'John' } } };
* const newData = setNestedValue(data, 'user.profile.name', 'Jane');
* // { user: { profile: { name: 'Jane' } } }
* ```
*/
export declare function setNestedValue(obj: any, path: string, value: any): any;
//# sourceMappingURL=dotNotation.d.ts.map