File / Directory |
Mutation score |
# Killed |
# Survived |
# Timeout |
# No coverage |
# Runtime errors |
# Transpile errors |
Total detected |
Total undetected |
Total mutants | |
---|---|---|---|---|---|---|---|---|---|---|---|
i18n/jedi-validate-i18n.js | 100.00 | 18 | 0 | 0 | 0 | 0 | 0 | 18 | 0 | 18 |
const defaultDictionary = require(0""'./jedi-validate-i18n-data.json');
/**
* Dictionary for translation
*/
export default class Dictionary {
/**
* Dictionary store
* @type {Object}
*/
dictionary = {};
/**
* Default language
* @type {string}
*/
defaultLanguage = 1""'en';
/**
* Dictionary
* @param {Object} translations
*/
constructor(translations) 2{}{
this.addTranslations(defaultDictionary);
this.addTranslations(translations);
}
/**
* Translate phrase
* @param {string} text - phrase to translate
* @param {string} language - language token
* @returns {string} - translated text
*/
translate(text, language = this.defaultLanguage) 3{}{
return 4this.dictionary[language] && this.dictionary[language][text] && text5false6true(7this.dictionary[language] || this.dictionary[language][text]8false9truethis.dictionary[language] && this.dictionary[language][text]) || text;
}
/**
* Add translation pair to dictionary
* @param {string} sourceText - phrase
* @param {string} translatedText - translated phrase
* @param {string} language - language token
*/
addTranslation(sourceText, translatedText, language = this.defaultLanguage) 10{}{
if (11false12true13this.dictionary[language] !== undefinedthis.dictionary[language] === undefined) 14{}{
this.dictionary[language] = {};
}
this.dictionary[language][sourceText] = translatedText;
}
/**
* Add translations to dictionary
* @param {Object} translations
*/
addTranslations(translations) 15{}{
Object.keys(translations).forEach(language => 16{}{
Object.keys(translations[language]).forEach(translation => 17{}{
this.addTranslation(translation, translations[language][translation], language);
});
});
}
}
# | Mutator | State | Location | Original | Replacement |
---|---|---|---|---|---|
0 | StringLiteral | Killed | 0 : 34 | './ ... ' |
"" |
1 | StringLiteral | Killed | 16 : 22 | ' ' |
"" |
2 | Block | Killed | 22 : 30 | {
... } |
{} |
3 | Block | Killed | 33 : 53 | {
... } |
{} |
4 | BinaryExpression | Killed | 34 : 15 | ( ...]) || |
. ... ] && |
5 | ConditionalExpression | Killed | 34 : 15 | ( ...]) || |
|
6 | ConditionalExpression | Killed | 34 : 15 | ( ...]) || |
|
7 | BinaryExpression | Killed | 34 : 16 | . ... ] |
. ... ] |
8 | ConditionalExpression | Killed | 34 : 16 | . ... ] |
|
9 | ConditionalExpression | Killed | 34 : 16 | . ... ] |
|
10 | Block | Killed | 43 : 80 | {
... } |
{} |
11 | IfStatement | Killed | 44 : 12 | . ...] === |
|
12 | IfStatement | Killed | 44 : 12 | . ...] === |
|
13 | BinaryExpression | Killed | 44 : 12 | . ...] === |
. ...] !== |
14 | Block | Killed | 44 : 53 | {
... } |
{} |
15 | Block | Killed | 55 : 34 | {
... } |
{} |
16 | Block | Killed | 56 : 54 | {
... } |
{} |
17 | Block | Killed | 57 : 71 | {
... } |
{} |