当前位置:网站首页>Recursively check if a configuration item has changed and replace it
Recursively check if a configuration item has changed and replace it
2022-08-02 02:45:00 【Xianyu_JavaScript】
介绍
- When the configuration item has the original configuration item,I don't want to change other configurations and can change the proposed configuration.参考 echarts 的配置
- 本文以递归的方式,实现了对象format check and replace,Arrays can be added according to the rules;
- The values that support the same attribute are based on the incoming attribute value;Properties that are not in the original configuration are added directly(当前级);
- According to the third point can be supported echarts、Secondary packaging configuration such as maps.
实现代码
const configSet = (config, eCData = echartsComponent.data) => {
if (!config) return;
Object.keys(eCData).forEach(key => {
if (!(key in config)) return
if (Object.prototype.toString.call(config[key]) === '[object Object]') return configSet(config[key], eCData[key])
eCData[key] = config[key]
})
Object.keys(config).forEach(key => {
if (!(key in eCData)) eCData[key] = config[key]
})
}
边栏推荐
- 第11章_数据库的设计规范
- 【每日一道LeetCode】——9. 回文数
- Qt自定义控件和模板分享
- The principle and code implementation of intelligent follower robot in the actual combat of innovative projects
- 面对职场“毕业”,PM&PMO应该如何从容的应对?如何跳槽能够大幅度升职加薪?
- BioVendor人俱乐部细胞蛋白(CC16)Elisa试剂盒研究领域
- 第10章_索引优化与查询优化
- 启发式合并、DSU on Tree
- MySQL索引优化实战
- PHP live source code to achieve simple barrage effect related code
猜你喜欢
随机推荐
架构:微服务网关(SIA-Gateway)简介
Qt自定义控件和模板分享
树链剖分-
Oracle数据类型介绍
mysql 查看死锁
Pinduoduo leverages the consumer expo to promote the upgrading of domestic agricultural products brands and keep pace with international high-quality agricultural products
BioVendor人俱乐部细胞蛋白(CC16)Elisa试剂盒研究领域
canal同步Mariadb到Mysql
【每日一道LeetCode】——9. 回文数
递归检查配置项是否更变并替换
1688API
亲身经历过的面试题
最大层内元素和
JVM调优实战
极大似然估计
1688以图搜货
esp32经典蓝牙和单片机连接,,,手机蓝牙作为主机
微服务:微智能在软件系统的简述
数仓:数仓从ETL到ELT架构的转化以及俩者的区别
记一次gorm事务及调试解决mysql死锁









