[improvement] rename packages dir to src (#3659)

This commit is contained in:
neverland
2019-06-27 11:25:57 +08:00
committed by GitHub
parent 8489918dca
commit 75c79b7044
619 changed files with 21 additions and 21 deletions

28
src/utils/index.ts Normal file
View File

@@ -0,0 +1,28 @@
import Vue from 'vue';
export { createNamespace } from './create';
export { suffixPx } from './format/unit';
export const isServer: boolean = Vue.prototype.$isServer;
export function noop() {}
export function isDef(value: any): boolean {
return value !== undefined && value !== null;
}
export function isObj(x: any): boolean {
const type = typeof x;
return x !== null && (type === 'object' || type === 'function');
}
export function get(object: any, path: string): any {
const keys = path.split('.');
let result = object;
keys.forEach(key => {
result = isDef(result[key]) ? result[key] : '';
});
return result;
}