当前位置:网站首页>Lodash get JS code implementation
Lodash get JS code implementation
2022-06-27 02:25:00 【Doll warning】
// Recursive value
function getValueByPath(data, pathArr, defultValue = '') {
function GET_VALUE_BY_PATH(data, pathArr, defultValue) {
if (pathArr.length === 0) {
okValue = data
return
} else if (pathArr[0] && data && (`${pathArr[0]}` in data)) {
GET_VALUE_BY_PATH(data[pathArr[0]], pathArr.slice(1, pathArr.length), defultValue)
} else {
return defultValue
}
}
// Logic
let okValue = ''
GET_VALUE_BY_PATH(data, pathArr, defultValue)
return okValue
}边栏推荐
- Oracle/PLSQL: Length Function
- Flink學習2:應用場景
- Precautions for using sneakemake
- memcached基础15
- Oracle/PLSQL: Rpad Function
- Press key to control LED status reversal
- Oracle/PLSQL: Trim Function
- D's appendto packaging
- Constraintlayout Development Guide
- How does the C # TCP server limit the number of connections to the same IP?
猜你喜欢

Learn Tai Chi Maker - mqtt Chapter 2 (3) reserved messages

WiFi-IoT 鸿蒙开发套件样例开发

Installing the Damon database using the command line

Is the division of each capability domain of Dama, dcmm and other data management frameworks reasonable? Is there internal logic?

Consumers pursue the iPhone because its cost performance exceeds that of domestic mobile phones

学习太极创客 — MQTT(六)ESP8266 发布 MQTT 消息

平均风向风速计算(单位矢量法)

lottie.js创意开关按钮动物头像

Learn Tai Chi Maker - mqtt (VIII) esp8266 subscribe to mqtt topic

Learn Tai Chi maker mqtt (IX) esp8266 subscribe to and publish mqtt messages at the same time
随机推荐
dat.gui.js星星圆圈轨迹动画js特效
学习太极创客 — MQTT 第二章(一)QoS 服务质量等级
How does the C # TCP server limit the number of connections to the same IP?
Enterprise digital transformation: informatization and digitalization
Memcached foundations 12
Oracle/PLSQL: Upper Function
paddlepaddle 20 指数移动平均(ExponentialMovingAverage,EMA)的实现与使用(支持静态图与动态图)
D's appendto packaging
Calculation of average wind direction and speed (unit vector method)
Oracle/PLSQL: NumToDSInterval Function
ORM cache package for laravel
Oracle/PLSQL: Lower Function
p5.js死亡星球
学习太极创客 — MQTT(八)ESP8266订阅MQTT主题
d的appendTo包装
Oracle/PLSQL: CharToRowid Function
剑指Offer || :栈与队列(简单)
h5液体动画js特效代码
Flink学习3:数据处理模式(流批处理)
Oracle/PLSQL: Rtrim Function