Comparing version 0.1.2 to 0.1.3
@@ -5,21 +5,3 @@ function buscaBR(){ | ||
buscaBR.prototype.codes = [ [/BL|BR/, 'B'], | ||
['PH', 'F'], | ||
[/GL|GR|MG|NG|RG/, 'G'], | ||
['Y', 'I'], | ||
[/GE|GI|RJ|MJ/, 'J'], | ||
[/CA|CO|CU|CK|Q/, 'K'], | ||
['N', 'M'], | ||
[/AO|AUM|GM|MD|OM|ON/, 'M'], | ||
['PR', 'P'], | ||
['L', 'R'], | ||
[/CE|CI|CH|CS|RS|TS|X|Z/, 'S'], | ||
[/TR|TL/, 'T'], | ||
[/CT|RT|ST|PT/, 'T'], | ||
[/\b[UW]/, 'V'], | ||
['RM', 'SM'], | ||
[/[MRS]+\b/, ''], | ||
[/[AEIOUH]/, ''] ]; | ||
buscaBR.prototype.searchSync = function(str, array){ | ||
@@ -42,5 +24,22 @@ var results = []; | ||
str = removeAcento(str.toUpperCase()); | ||
for(var i = 0; i < this.codes.length; i++){ | ||
var codes = [ [/BL|BR/, 'B'], | ||
['PH', 'F'], | ||
[/GL|GR|MG|NG|RG/, 'G'], | ||
['Y', 'I'], | ||
[/GE|GI|RJ|MJ/, 'J'], | ||
[/CA|CO|CU|CK|Q/, 'K'], | ||
['N', 'M'], | ||
[/AO|AUM|GM|MD|OM|ON/, 'M'], | ||
['PR', 'P'], | ||
['L', 'R'], | ||
[/CE|CI|CH|CS|RS|TS|X|Z/, 'S'], | ||
[/TR|TL/, 'T'], | ||
[/CT|RT|ST|PT/, 'T'], | ||
[/\b[UW]/, 'V'], | ||
['RM', 'SM'], | ||
[/[MRS]+\b/, ''], | ||
[/[AEIOUH]/, ''] ]; | ||
for(var i = 0; i < codes.length; i++){ | ||
// str = str.replace(this.codes[i][0],this.codes[i][1]); | ||
str = str.split(this.codes[i][0]).join(this.codes[i][1]) | ||
str = str.split(codes[i][0]).join(codes[i][1]) | ||
} | ||
@@ -47,0 +46,0 @@ |
@@ -19,3 +19,3 @@ { | ||
], | ||
"version": "0.1.2", | ||
"version": "0.1.3", | ||
"author": { | ||
@@ -22,0 +22,0 @@ "name": "Jayr Alencar", |
@@ -53,6 +53,13 @@ # buscaBR.js | ||
```js | ||
var buscabr = new buscaBR(); | ||
console.log(console.log(buscaBR.encode('paralelepipedo'))); | ||
var buscabr = require('busca-br').encode(); | ||
console.log(buscabr('paralalepipedo')); | ||
//Vai retornar | ||
``` | ||
Ou no browser.. | ||
```js | ||
var buscabr = new buscaBR(); | ||
alert(buscabr.encode('paralalepipedo')) | ||
``` | ||
## Exemplos de respostas | ||
@@ -77,2 +84,1 @@ <table> | ||
</table> | ||
``` |
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
9159
83