deep extend (like jQuery's) for nodeJS

后端 未结 11 897
情歌与酒
情歌与酒 2020-12-13 17:27

I am struggling with deep copies of objects in nodeJS. my own extend is crap. underscore\'s extend is flat. there are rather simple extend variants here on stackexchange, bu

11条回答
  •  孤街浪徒
    2020-12-13 18:24

    In Node.js, You can use Extendify to create an _.extend function that supports nested objects extension (deep extend) and is also immutable to it's params (hence deep clone).

    _.extend = extendify({
        inPlace: false,
        isDeep: true
    });
    

提交回复
热议问题