chore: prettier source code

This commit is contained in:
chenjiahan
2020-04-02 15:36:02 +08:00
parent 340c56b3b5
commit 2fb5cca49a
93 changed files with 272 additions and 283 deletions
+1 -1
View File
@@ -30,7 +30,7 @@ function gen(name: string, mods?: Mods): string {
}
export function createBEM(name: string) {
return function(el?: Mods, mods?: Mods): Mods {
return function (el?: Mods, mods?: Mods): Mods {
if (el && typeof el !== 'string') {
mods = el;
el = '';
+2 -2
View File
@@ -43,7 +43,7 @@ export function unifySlots(context: RenderContext) {
const scopedSlots = context.scopedSlots || context.data.scopedSlots || {};
const slots = context.slots();
Object.keys(slots).forEach(key => {
Object.keys(slots).forEach((key) => {
if (!scopedSlots[key]) {
scopedSlots[key] = () => slots[key];
}
@@ -66,7 +66,7 @@ function transformFunctionComponent(
}
export function createComponent(name: string) {
return function<Props = DefaultProps, Events = {}, Slots = {}>(
return function <Props = DefaultProps, Events = {}, Slots = {}>(
sfc: VantComponentOptions | FunctionComponent
): TsxComponent<Props, Events, Slots> {
if (isFunction(sfc)) {
+1 -1
View File
@@ -5,7 +5,7 @@ import locale from '../../locale';
export function createI18N(name: string) {
const prefix = camelize(name) + '.';
return function(path: string, ...args: any[]): string {
return function (path: string, ...args: any[]): string {
const messages = locale.messages();
const message = get(messages, prefix + path) || get(messages, path);
+1 -1
View File
@@ -19,7 +19,7 @@ function assignKey(to: ObjectIndex, from: ObjectIndex, key: string) {
}
export function deepAssign(to: ObjectIndex, from: ObjectIndex): ObjectIndex {
Object.keys(from).forEach(key => {
Object.keys(from).forEach((key) => {
assignKey(to, from, key);
});
+1 -1
View File
@@ -2,7 +2,7 @@ import { deepAssign } from './deep-assign';
export function deepClone(obj: object): object {
if (Array.isArray(obj)) {
return obj.map(item => deepClone(item));
return obj.map((item) => deepClone(item));
}
if (typeof obj === 'object') {
+1 -1
View File
@@ -43,7 +43,7 @@ export function emit(context: Context, eventName: string, ...args: any[]) {
const listeners = context.listeners[eventName];
if (listeners) {
if (Array.isArray(listeners)) {
listeners.forEach(listener => {
listeners.forEach((listener) => {
listener(...args);
});
} else {
+1 -1
View File
@@ -27,7 +27,7 @@ export function get(object: any, path: string): any {
const keys = path.split('.');
let result = object;
keys.forEach(key => {
keys.forEach((key) => {
result = isDef(result[key]) ? result[key] : '';
});
+1 -1
View File
@@ -18,7 +18,7 @@ export function route(router: VueRouter, config: RouteConfig) {
/* istanbul ignore else */
if (promise && promise.catch) {
promise.catch(err => {
promise.catch((err) => {
/* istanbul ignore if */
if (err && err.name !== 'NavigationDuplicated') {
throw err;
+1 -1
View File
@@ -5,7 +5,7 @@ function flattenVNodes(vnodes: VNode[]) {
const result: VNode[] = [];
function traverse(vnodes: VNode[]) {
vnodes.forEach(vnode => {
vnodes.forEach((vnode) => {
result.push(vnode);
if (vnode.children) {