junliangwangx / bootsjs Goto Github PK
View Code? Open in Web Editor NEWBeing needed by others is a very happy thing, so there is BootsJS, a powerful JS tool library.
Home Page: https://junliangwangx.github.io/BootsJS/
License: MIT License
Being needed by others is a very happy thing, so there is BootsJS, a powerful JS tool library.
Home Page: https://junliangwangx.github.io/BootsJS/
License: MIT License
添加合并对象方法
可根据value类型进行深度合并
const obj1 = {
arr: [
{
name: 'zhangsan',
score: 100
},
{
name: 'lisi',
score: 95
}
],
str: 'str',
obj: {
arr: [
{
name: 'wangwu',
score: 88
},
{
name: 'zhaoliu',
score: 99
}
]
}
}
const obj2 = {
arr: [
{
name: 'zhangsan',
score: 44
},
{
name: 'sunqi',
score: 77
}
],
obj: {
test: 'test',
}
}
const obj3 = ObjectTools.deepMerge(obj1, obj2)
// console.log(obj3)
{
arr: [
{
name: 'zhangsan',
score: 44
},
{
name: 'lisi',
score: 95
},
{
name: 'sunqi',
score: 77
}
],
str: 'str',
obj: {
arr: [
{
name: 'wangwu',
score: 88
},
{
name: 'zhaoliu',
score: 99
}
],
test: 'test'
}
}
比如数据的根节点不是第一条的情况:
const arr = [
{ name: '重庆', code: '01', level:1 , parentCode: '0' },
{ name: '四川', code: '02', level:1 , parentCode: '0' },
{ name: '广东', code: '03', level:1 , parentCode: '0' },
{ name: '**', code: '0' , level:0 },
]
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.