Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

any-translate

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

any-translate - npm Package Compare versions

Comparing version 0.0.2 to 0.0.3

3

dist/createMapTokens.js

@@ -14,3 +14,3 @@ 'use strict';

Translate
} from 'any-translate/i/interfaces'*/
} from 'any-translate'*/

@@ -24,3 +24,2 @@

var tokens /*: TranslateArgs*/ = {};
var keys /*: Array<string>*/ = Object.keys(params);

@@ -27,0 +26,0 @@ for (var i = 0, l = keys.length; i < l; i++) {

@@ -16,4 +16,5 @@ 'use strict';

TokenizedTranslate,
TranslateArgs
} from 'any-translate/i/interfaces'*/
TranslateArgs,
HasTranslation
} from 'any-translate'*/
function createTranslate(bf /*: Translator*/) /*: TokenizedTranslate*/ {

@@ -27,3 +28,3 @@ function translate(message /*: string*/, params /*: TranslateArgs*/) /*: string*/ {

function createHasTranslation(bf /*: Translator*/) /*: (message: string) => boolean*/ {
function createHasTranslation(bf /*: Translator*/) /*: HasTranslation*/ {
return function hasTranslation(message /*: string*/) /*: boolean*/ {

@@ -30,0 +31,0 @@ return bf.has(message);

/* @flow */
import type {
Translator,
TokenizedTranslate,
Translate
} from 'any-translate/i/interfaces'
declare module 'any-translate' {
declare type TokenSubject = string|Function|Object;
declare type TokenizerParams = {[id: string]: TokenSubject};
declare type TranslateArgs = {[id: string]: string};
declare type Translate = (
message: string,
params: TranslateArgs
) => string;
declare module 'any-translate' {
declare type TokenizedTranslate = (
message: string,
params: TokenizerParams
) => Array<TokenSubject>|string;
declare type NeedTranslate = (locale: string, message: string) => void;
declare interface Translator {
add(phrases: Object): void;
translate(message: string, params: TranslateArgs): string;
has(message: string): boolean;
}
declare type CreateTranslator = (
locale: string,
phrases: Object,
needTranslate?: NeedTranslate
) => Translator;
declare type HasTranslation = (message: string) => boolean;
declare function createMapTokens(t: Translate): TokenizedTranslate;
declare function createTranslate(bf: Translator): TokenizedTranslate;
declare function createHasTranslation(bf: Translator): (message: string) => boolean
declare function createHasTranslation(bf: Translator): HasTranslation
}
{
"name": "any-translate",
"version": "0.0.2",
"version": "0.0.3",
"description": "Decorator for any i18n library",

@@ -47,4 +47,3 @@ "publishConfig": {

"flow-typed",
"dist",
"i"
"dist"
],

@@ -51,0 +50,0 @@ "devDependencies": {

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc