-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: remove freeze and add some test cases (#53)
* feat: remove freeze and add some test cases * fix: rename isObject > isPlainObject * fix: export toRaw
- Loading branch information
Rongyan Chen
authored
Apr 20, 2022
1 parent
34e7e57
commit a75b9a7
Showing
8 changed files
with
86 additions
and
91 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { isArray, isPlainObject, isMap, isSet } from './checkTypes'; | ||
|
||
// Shallow Clone the Property value | ||
// Attention, it only clones Set\Map\Array\Plain Object | ||
export function shallowClone(value: any) { | ||
if (isSet(value)) { | ||
return new Set(value); | ||
} | ||
|
||
if (isMap(value)) { | ||
return new Map(value); | ||
} | ||
|
||
if (isArray(value)) { | ||
return [...value]; | ||
} | ||
|
||
if (isPlainObject(value)) { | ||
return Object.assign({}, value); | ||
} | ||
|
||
return value; | ||
} |
This file was deleted.
Oops, something went wrong.