There was an error while loading. Please reload this page.
1 parent 4ef90ef commit d4b8e41Copy full SHA for d4b8e41
src/utils/index.js
@@ -0,0 +1,10 @@
1
+export function cloneShallow (obj) {
2
+ return Object.keys(obj).reduce((acc, prop) => {
3
+ if (Array.isArray(obj[prop])) {
4
+ acc[prop] = obj[prop].slice(0)
5
+ } else {
6
+ acc[prop] = obj[prop]
7
+ }
8
+ return acc
9
+ }, {})
10
+}
0 commit comments