UNPKG

element-ui

Version:

A Component Library for Vue.js.

44 lines (39 loc) 888 B
'use strict'; exports.__esModule = true; exports.hasOwn = hasOwn; exports.toObject = toObject; var hasOwnProperty = Object.prototype.hasOwnProperty; function hasOwn(obj, key) { return hasOwnProperty.call(obj, key); }; function extend(to, _from) { for (var key in _from) { to[key] = _from[key]; } return to; }; function toObject(arr) { var res = {}; for (var i = 0; i < arr.length; i++) { if (arr[i]) { extend(res, arr[i]); } } return res; }; var getValueByPath = exports.getValueByPath = function getValueByPath(object, prop) { prop = prop || ''; var paths = prop.split('.'); var current = object; var result = null; for (var i = 0, j = paths.length; i < j; i++) { var path = paths[i]; if (!current) break; if (i === j - 1) { result = current[path]; break; } current = current[path]; } return result; };