single-deepcopy
v2.0.0
Published
source deep copy
Downloads
2
Readme
single-deepcoy
a plugin for deep copy
install
- npm install single-deepcopy
- yarn add single-deepcopy
import mode
mode1
import deepcopy from 'single-deepcopy'
mode2
const deepcopy = require('single-deepcopy')
use
const deepcopy = require('single-deepcopy')
const obj = {
married: true,
age: 10,
name: 'zhufeng',
girlfriend: null,
boyfriend: undefined,
flag: Symbol('man'),
home: { name: '北京' },
set: new Set(),
map: new Map(),
getName() {},
hobbies: ['抽烟', '喝酒', '烫头'],
error: new Error('error'),
pattern: /^regexp$/gi,
math: Math,
json: JSON,
document,
window
}
const b = deepcopy(obj)
console.log(b)