From 06946ee3d1a0780926f771becfe388565b2f9616 Mon Sep 17 00:00:00 2001 From: Christian Kaisermann Date: Thu, 21 Nov 2019 22:12:56 -0300 Subject: [PATCH] =?UTF-8?q?refactor:=20=F0=9F=92=A1=20rename=20addMessages?= =?UTF-8?q?To=20to=20addMessages?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/client/includes/loaderQueue.ts | 4 ++-- src/client/index.ts | 2 +- src/client/stores/dictionary.ts | 4 ++-- test/client/index.test.ts | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/client/includes/loaderQueue.ts b/src/client/includes/loaderQueue.ts index e250ed1..4db9bab 100644 --- a/src/client/includes/loaderQueue.ts +++ b/src/client/includes/loaderQueue.ts @@ -2,7 +2,7 @@ import { MessagesLoader } from '../types' import { hasLocaleDictionary, $dictionary, - addMessagesTo, + addMessages, } from '../stores/dictionary' import { getCurrentLocale } from '../stores/locale' import { $isLoading } from '../stores/loading' @@ -62,7 +62,7 @@ export async function flushQueue(locale: string = getCurrentLocale()) { partials = partials.map(partial => partial.default || partial) removeFromLookupCache(locale) - addMessagesTo(locale, ...partials) + addMessages(locale, ...partials) }) .then(() => { clearTimeout(loadingDelay) diff --git a/src/client/index.ts b/src/client/index.ts index d973e9e..24f88df 100644 --- a/src/client/index.ts +++ b/src/client/index.ts @@ -20,7 +20,7 @@ export { $locale as locale, loadLocale as preloadLocale } from './stores/locale' export { $dictionary as dictionary, $locales as locales, - addMessagesTo, + addMessages, } from './stores/dictionary' export { $isLoading as isLoading } from './stores/loading' export { $format as format, $format as _, $format as t } from './stores/format' diff --git a/src/client/stores/dictionary.ts b/src/client/stores/dictionary.ts index 0a62393..04428b8 100644 --- a/src/client/stores/dictionary.ts +++ b/src/client/stores/dictionary.ts @@ -18,7 +18,7 @@ function hasLocaleDictionary(locale: string) { return locale in dictionary } -function addMessagesTo(locale: string, ...partials: LocaleDictionary[]) { +function addMessages(locale: string, ...partials: LocaleDictionary[]) { $dictionary.update(d => { dictionary[locale] = merge.all([dictionary[locale] || {}].concat(partials)) return d @@ -34,5 +34,5 @@ export { $locales, getDictionary, hasLocaleDictionary, - addMessagesTo, + addMessages, } diff --git a/test/client/index.test.ts b/test/client/index.test.ts index ecae6d0..aa4320f 100644 --- a/test/client/index.test.ts +++ b/test/client/index.test.ts @@ -1,4 +1,4 @@ -// todo this is a mess +// TODO remake this, it's a mess import { Formatter } from '../../src/client/types' import { dictionary,