File tree Expand file tree Collapse file tree 2 files changed +2
-1
lines changed
Expand file tree Collapse file tree 2 files changed +2
-1
lines changed Original file line number Diff line number Diff line change @@ -175,6 +175,7 @@ export const cloneToMut = <$Group extends Any>(group: $Group): cloneToMut<$Group
175175 * ```
176176 */
177177export const toImmutable = < $Group extends AnyMut > ( group : $Group ) : toImmutable < $Group > => {
178+ if ( Object . isFrozen ( group ) ) return group as any
178179 const result : AnyMut = { }
179180 for ( const k in group ) {
180181 result [ k ] = Obj . toImmutableMut ( [ ...( group [ k ] as any [ ] ) ] ) as any
Original file line number Diff line number Diff line change @@ -49,7 +49,7 @@ export interface ErrorMutableInputImmutableOutput extends
4949 * ```
5050 */
5151export const toImmutable = < $obj extends object > ( obj : $obj ) : toImmutable < $obj > => {
52- // todo: copy trait instead of hardcoded copy logic here
52+ if ( Object . isFrozen ( obj ) ) return obj as toImmutable < $obj >
5353 const copy = ( Array . isArray ( obj ) ? [ ...obj ] : { ...obj } ) as $obj
5454 return toImmutableMut ( copy )
5555}
You can’t perform that action at this time.
0 commit comments