From 202532c301b9ff01eab7e31a804f96ccb6c94a2c Mon Sep 17 00:00:00 2001 From: Evan You Date: Mon, 17 Feb 2020 14:43:16 -0500 Subject: [PATCH] chore: use consistent signature for shared utilities --- packages/shared/src/index.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/shared/src/index.ts b/packages/shared/src/index.ts index 68daa4b2..b08300cd 100644 --- a/packages/shared/src/index.ts +++ b/packages/shared/src/index.ts @@ -50,7 +50,7 @@ export const isSymbol = (val: unknown): val is symbol => typeof val === 'symbol' export const isObject = (val: unknown): val is Record => val !== null && typeof val === 'object' -export function isPromise(val: unknown): val is Promise { +export const isPromise = (val: unknown): val is Promise => { return isObject(val) && isFunction(val.then) && isFunction(val.catch) } @@ -58,7 +58,7 @@ export const objectToString = Object.prototype.toString export const toTypeString = (value: unknown): string => objectToString.call(value) -export function toRawType(value: unknown): string { +export const toRawType = (value: unknown): string => { return toTypeString(value).slice(8, -1) } @@ -72,7 +72,7 @@ export const isReservedProp = /*#__PURE__*/ makeMap( 'onVnodeBeforeUnmount,onVnodeUnmounted' ) -function cacheStringFunction string>(fn: T): T { +const cacheStringFunction = string>(fn: T): T => { const cache: Record = Object.create(null) return ((str: string) => { const hit = cache[str] @@ -105,7 +105,7 @@ export const hasChanged = (value: any, oldValue: any): boolean => value !== oldValue && (value === value || oldValue === oldValue) // for converting {{ interpolation }} values to displayed strings. -export function toDisplayString(val: unknown): string { +export const toDisplayString = (val: unknown): string => { return val == null ? '' : isArray(val) || (isPlainObject(val) && val.toString === objectToString)