@ewb/translate
Advanced tools
Comparing version 1.4.0 to 1.4.1
@@ -11,3 +11,3 @@ import Branch, { Translations } from './Branch'; | ||
add(translations?: Translations): void; | ||
suggestions(): string; | ||
suggestions(): Branch[]; | ||
} |
@@ -37,3 +37,3 @@ "use strict"; | ||
} | ||
return words.map(x => x.word).join(', '); | ||
return words; | ||
} | ||
@@ -40,0 +40,0 @@ } |
@@ -40,4 +40,6 @@ import Tree, { WordTranslations, TreeOptions } from './Tree'; | ||
exportTexts(): WordTranslations; | ||
getBranch(wordOrText: string): Branch | null; | ||
delete(wordOrText: string): boolean; | ||
getWord(word: string): Branch | null; | ||
getText(text: string): Branch | null; | ||
getBranch(wordOrText: string, isText?: boolean): Branch | null; | ||
delete(wordOrText: string): Branch | null; | ||
private _branch; | ||
@@ -44,0 +46,0 @@ private replaceVariables; |
@@ -73,5 +73,14 @@ "use strict"; | ||
// todo: Create test | ||
getBranch(wordOrText) { | ||
return this._branch(wordOrText); | ||
getWord(word) { | ||
return this.getBranch(word); | ||
} | ||
// todo: Create test | ||
getText(text) { | ||
return this.getBranch(text, true); | ||
} | ||
// todo: Create test | ||
getBranch(wordOrText, isText = false) { | ||
return this._branch(wordOrText, isText); | ||
} | ||
// todo: Create test | ||
delete(wordOrText) { | ||
@@ -81,14 +90,18 @@ const branch = this._branch(wordOrText); | ||
branch.isWord = false; | ||
return true; | ||
return branch; | ||
} | ||
return false; | ||
return null; | ||
} | ||
_branch(wordOrText) { | ||
const word = this.tree.word(wordOrText); | ||
if (word instanceof Branch_1.default) { | ||
return word; | ||
_branch(wordOrText, isText = false) { | ||
if (!isText) { | ||
const word = this.tree.word(wordOrText); | ||
if (word instanceof Branch_1.default) { | ||
return word; | ||
} | ||
} | ||
const text = this.tree.text(wordOrText); | ||
if (text instanceof Branch_1.default) { | ||
return text; | ||
else { | ||
const text = this.tree.text(wordOrText); | ||
if (text instanceof Branch_1.default) { | ||
return text; | ||
} | ||
} | ||
@@ -95,0 +108,0 @@ return null; |
{ | ||
"name": "@ewb/translate", | ||
"version": "1.4.0", | ||
"version": "1.4.1", | ||
"description": "Translate as you create your app. Saves the words and text in a tree structure for fast and easy lookup.", | ||
@@ -5,0 +5,0 @@ "main": "./lib/index.js", |
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
152557
716