[Improvement] optimize utils (#661)

This commit is contained in:
neverland
2018-03-02 14:39:26 +08:00
committed by GitHub
parent 39cdaf0907
commit 92b116c071
7 changed files with 24 additions and 22 deletions

View File

@@ -7,6 +7,11 @@ function isDef(value) {
return value !== undefined && value !== null;
}
function isObj(x) {
const type = typeof x;
return x !== null && (type === 'object' || type === 'function');
}
function get(object, path) {
const keys = path.split('.');
let result = object;
@@ -30,6 +35,7 @@ function isAndroid() {
export {
get,
isObj,
isDef,
create,
isServer,