当前位置:网站首页>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]
})
}
边栏推荐
- 【LeetCode】102.二叉树的层序遍历
- 局部敏感哈希:如何在常数时间内搜索Embedding最近邻
- Docker-compose安装mysql
- 启发式合并、DSU on Tree
- 【CNN记录】tensorflow slice和strided_slice
- PAT甲级打卡-1001-1004
- analog IC layout-Design for reliability
- Moonbeam and Project integration of the Galaxy, bring brand-new user experience for the community
- Remember a gorm transaction and debug to solve mysql deadlock
- 数仓:数仓从ETL到ELT架构的转化以及俩者的区别
猜你喜欢

The principle and code implementation of intelligent follower robot in the actual combat of innovative projects
![[Unity entry plan] 2D Game Kit: A preliminary understanding of the composition of 2D games](/img/8a/07ca69c6dcc22757156cb615e241f8.png)
[Unity entry plan] 2D Game Kit: A preliminary understanding of the composition of 2D games

feign调用不通问题,JSON parse error Illegal character ((CTRL-CHAR, code 31)) only regular white space (r

指针数组和数组指针

canal同步Mariadb到Mysql

记一次gorm事务及调试解决mysql死锁

记一个gorm初始化的坑

极大似然估计

国标GB28181协议EasyGBS平台兼容老版本收流端口的功能实现

面对职场“毕业”,PM&PMO应该如何从容的应对?如何跳槽能够大幅度升职加薪?
随机推荐
The first time I wrote a programming interview question for Niu Ke: input a string and return the letter with the most occurrences of the string
Oracle数据类型介绍
analog IC layout-Parasitic effects
Analysis of the status quo of digital transformation of manufacturing enterprises
mysql 查看死锁
【web】理解 Cookie 和 Session 机制
2022-07-30 mysql8 executes slow SQL-Q17 analysis
29. 删除链表中重复的节点
【CNN记录】tensorflow slice和strided_slice
欧拉公式的证明
esp32经典蓝牙和单片机连接,,,手机蓝牙作为主机
TKU remembers a single-point QPS optimization (I wish ITEYE is finally back)
Rasa 3 x learning series - Rasa - 4873 dispatcher Issues. Utter_message study notes
isa指针使用详情
【ORB_SLAM2】void Frame::AssignFeaturesToGrid()
1688以图搜货
2022年NPDP考完多久出成绩?怎么查询?
2022-08-01 mysql/stoonedb slow SQL-Q18 analysis
Curriculum Vitae;CV
机器人领域期刊会议汇总