any-translate
Advanced tools
Comparing version 0.0.3 to 0.0.4
@@ -9,3 +9,3 @@ 'use strict'; | ||
/*:: import type { | ||
TokenizedTranslate, | ||
Tr, | ||
TokenSubject, | ||
@@ -24,2 +24,7 @@ TokenizerParams, | ||
var tokens /*: TranslateArgs*/ = {}; | ||
if (!params) { | ||
return t(message, tokens); | ||
} | ||
var keys /*: Array<string>*/ = Object.keys(params); | ||
@@ -62,3 +67,3 @@ for (var i = 0, l = keys.length; i < l; i++) { | ||
function createMapTokens(t /*: Translate*/) /*: TokenizedTranslate*/ { | ||
function createMapTokens(t /*: Translate*/) /*: Tr*/ { | ||
return function _mapTokens(message /*: string*/, params /*: TokenizerParams*/) /*: Array<TokenSubject>|string*/ { | ||
@@ -65,0 +70,0 @@ return mapTokens(t, message, params); |
@@ -15,7 +15,7 @@ 'use strict'; | ||
Translator, | ||
TokenizedTranslate, | ||
Tr, | ||
TranslateArgs, | ||
HasTranslation | ||
} from 'any-translate'*/ | ||
function createTranslate(bf /*: Translator*/) /*: TokenizedTranslate*/ { | ||
function createTranslate(bf /*: Translator*/) /*: Tr*/ { | ||
function translate(message /*: string*/, params /*: TranslateArgs*/) /*: string*/ { | ||
@@ -22,0 +22,0 @@ return bf.translate(message, params); |
@@ -12,5 +12,5 @@ /* @flow */ | ||
declare type TokenizedTranslate = ( | ||
declare type Tr = ( | ||
message: string, | ||
params: TokenizerParams | ||
params?: TokenizerParams | ||
) => Array<TokenSubject>|string; | ||
@@ -34,5 +34,5 @@ | ||
declare function createMapTokens(t: Translate): TokenizedTranslate; | ||
declare function createTranslate(bf: Translator): TokenizedTranslate; | ||
declare function createMapTokens(t: Translate): Tr; | ||
declare function createTranslate(bf: Translator): Tr; | ||
declare function createHasTranslation(bf: Translator): HasTranslation | ||
} |
{ | ||
"name": "any-translate", | ||
"version": "0.0.3", | ||
"version": "0.0.4", | ||
"description": "Decorator for any i18n library", | ||
@@ -5,0 +5,0 @@ "publishConfig": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
122
13414