Skip to content

Object Operations

Deep merge, flatten, dot-path get/set, and unflatten.

5 modules

ModuleDescription
깊은 병합여러 객체를 깊게 병합
객체 평탄화중첩된 객체를 단일 레벨로 평탄화
값 가져오기경로를 통해 객체에서 값 가져오기
값 설정경로를 통해 객체에 값 설정
객체 복원점 표기법으로 평탄화된 객체를 중첩으로 변환

Modules

깊은 병합

object.deep_merge

여러 객체를 깊게 병합

Parameters:

NameTypeRequiredDefaultDescription
objectsarrayYes-병합할 객체 배열
array_mergestringNoreplace병합할 객체 배열

Output:

FieldTypeDescription
resultobject병합된 객체

객체 평탄화

object.flatten

중첩된 객체를 단일 레벨로 평탄화

Parameters:

NameTypeRequiredDefaultDescription
objectobjectYes-평탄화할 중첩 객체
separatorstringNo.평탄화할 중첩 객체
max_depthnumberNo0키 구분자

Output:

FieldTypeDescription
resultobject평탄화할 최대 깊이 (0 = 무제한)
keysarray평탄화된 객체

값 가져오기

object.get

경로를 통해 객체에서 값 가져오기

Parameters:

NameTypeRequiredDefaultDescription
objectobjectYes-값을 가져올 객체
pathstringYes-값을 가져올 객체
defaultanyNo-점 표기법 경로

Output:

FieldTypeDescription
valueany경로를 찾지 못했을 때 기본값
foundboolean가져온 값

값 설정

object.set

경로를 통해 객체에 값 설정

Parameters:

NameTypeRequiredDefaultDescription
objectobjectYes-수정할 객체
pathstringYes-수정할 객체
valueanyYes-점 표기법 경로

Output:

FieldTypeDescription
resultobject설정할 값

객체 복원

object.unflatten

점 표기법으로 평탄화된 객체를 중첩으로 변환

Parameters:

NameTypeRequiredDefaultDescription
objectobjectYes-복원할 평탄화된 객체
separatorstringNo.복원할 평탄화된 객체

Output:

FieldTypeDescription
resultobject키 구분자

Released under the Apache 2.0 License.