This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var database = [ | |
{ | |
"jap": "あ", | |
"roman": "a" | |
}, | |
{ | |
"jap": "い", | |
"roman": "i" | |
}, | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Clean Object | |
* Cleans object from keys are not being used | |
* @param {Object} dirty | |
* @returns {Object} clean | |
*/ | |
function cleanObject(object) { | |
var keys = Object.keys(object); | |
keys.map(function(obj, i) { | |
var value = object[obj]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Tells if a value is numeric or not | |
function isNumeric(num){ | |
return !isNaN(num) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Trim Object | |
* Trims all strings in all levels | |
* @param {Object} dirty | |
* @returns {Object} clean | |
*/ | |
function trimObject(object){ | |
if(typeof object === 'string'){ | |
object = object.trim().replace(/\t/g,'').replace(/\n/g,''); | |
}else if(object instanceof Array){ |