mining-utils
Advanced tools
Comparing version 0.0.2 to 0.1.0
@@ -1,7 +0,1 @@ | ||
import { stringsManipulation } from './strings/index' | ||
stringsManipulation.removeAccent('Mussum Ipsum, cacilds vidis litro abertis. Em pé sem cair, deitado sem dormir, sentado sem cochilar e fazendo pose. Suco de cevadiss deixa as pessoas mais interessantis. Todo mundo vê os porris que eu tomo, mas ninguém vê os tombis que eu levo! Per aumento de cachacis, eu reclamis. ') | ||
// ['áÁàÀãÃâÂäÄ', 'éÉèÈẽẼêÊëË', 'íÍìÌĩĨîÎ', 'óÓòÒõÕÔ', 'úÚùÙũŨÛ', 'çÇĉĈ', 'ǵǴĝĜ', 'ĥĤḧḦ' | ||
// , 'ĵĴ', 'ḱḰ', 'ĺĹ', 'ḿḾ', 'ńŃǹǸñÑ', 'ṕṔ', 'ŕŔ', 'śŚŝŜ', 'ẗ', 'ǘǗǜǛṽṼ', 'ẃẂẁẀŵŴẅẄ', 'ẍẌ', 'ýÝỳỲŷŶỹỸ', 'źŹẑẐ'] | ||
import * as stringChanges from './strings/index' |
{ | ||
"name": "mining-utils", | ||
"version": "0.0.2", | ||
"version": "0.1.0", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "author": "Oracy Rezende Martos <oramartos_21@hotmail.com> (https://github.com/Oracy)", |
@@ -1,23 +0,37 @@ | ||
export const removeAccent = (phrase?: string, words?: string[]): string[] | string => { | ||
if (phrase){ | ||
const removeAccent = (phrase: string | string[]): string[] | string => { | ||
try { | ||
const replace: string[] = ['a', 'e', 'i', 'o', 'u', 'c', 'g', 'h', 'j', 'k', 'l', 'm', 'n', 'p', 'r', 's', 't', 'u', 'w', 'x', 'y', 'z'] | ||
const accent: string[] = ['áÁàÀãÃâÂäÄ', 'éÉèÈẽẼêÊëË', 'íÍìÌĩĨîÎ', 'óÓòÒõÕÔ', 'úÚùÙũŨÛ', 'çÇĉĈ', 'ǵǴĝĜ', 'ĥĤḧḦ' | ||
, 'ĵĴ', 'ḱḰ', 'ĺĹ', 'ḿḾ', 'ńŃǹǸñÑ', 'ṕṔ', 'ŕŔ', 'śŚŝŜ', 'ẗ', 'ǘǗǜǛṽṼ', 'ẃẂẁẀŵŴẅẄ', 'ẍẌ', 'ýÝỳỲŷŶỹỸ', 'źŹẑẐ'] | ||
let newString: string = '' | ||
, 'ĵĴ', 'ḱḰ', 'ĺĹ', 'ḿḾ', 'ńŃǹǸñÑ', 'ṕṔ', 'ŕŔ', 'śŚŝŜ', 'ẗ', 'ǘǗǜǛṽṼ', 'ẃẂẁẀŵŴẅẄ', 'ẍẌ', 'ýÝỳỲŷŶỹỸ', 'źŹẑẐ'] | ||
for (const word of accent) { | ||
if (phrase.match(`/[${word}]/gi`)) { | ||
accent.indexOf(word) | ||
newString = phrase.replace(`[${word}]`, replace[accent.indexOf(word)]) | ||
} else{ | ||
// console.log(word) | ||
let reg: RegExp | ||
let data: string | ||
if (!Array.isArray(phrase)) { | ||
data = phrase.toString() | ||
for (const word of accent) { | ||
if (data.match(`[${word}]`)) { | ||
reg = new RegExp(`[${accent[accent.indexOf(word)]}]`, "g") | ||
data = data.replace(reg, replace[accent.indexOf(word)]) | ||
} | ||
} | ||
return data | ||
} else { | ||
for (let x = 0; x < phrase.length; x++) { | ||
for (const word of accent) { | ||
if (phrase[x].match(`[${word}]`)) { | ||
reg = new RegExp(`[${accent[accent.indexOf(word)]}]`, "g") | ||
phrase[x] = phrase[x].replace(reg, replace[accent.indexOf(word)]) | ||
} | ||
} | ||
} | ||
return phrase | ||
} | ||
console.log(newString) | ||
// const newStr: string = phrase.replace(replace, "") | ||
return 'a' | ||
}else{ | ||
return 'a' | ||
} catch (err) { | ||
throw err | ||
} | ||
} | ||
export const accent = removeAccent |
86
3572