Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

js-brasil

Package Overview
Dependencies
Maintainers
1
Versions
86
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

js-brasil - npm Package Compare versions

Comparing version 2.3.8 to 2.3.9

25

addons/pessoas.ts

@@ -46,3 +46,3 @@ import { BigObject } from "../src/interfaces";

se: [[49000000, 49999999]],
sp: [[ 1000000, 19999999]],
sp: [[1000000, 19999999]],
to: [[77000000, 77999999]]

@@ -53,3 +53,3 @@ }

export function getAstro(data:string|Date) {
export function getAstro(data: string | Date) {
let month, day;

@@ -68,23 +68,24 @@ if (typeof data === 'string') {

return 'Capricórnio';
} else if ((month == 2 && day < 19) || (month == 1 && day >= 22)) {
} else if ((month == 2 && day < 19) || (month == 1 && day >= 20)) {
return 'Aquários';
} else if ((month == 3 && day < 21) || (month == 2 && day >= 24)) {
} else if ((month == 3 && day < 21) || (month == 2 && day >= 19)) {
return 'Peixes';
} else if ((month == 4 && day < 20) || (month == 3 && day >= 23)) {
} else if ((month == 4 && day < 20) || (month == 3 && day >= 21)) {
return 'Aries';
} else if ((month == 5 && day < 21) || (month == 4 && day >= 23)) {
} else if ((month == 5 && day < 21) || (month == 4 && day >= 20)) {
return 'Touro';
} else if ((month == 6 && day < 22) || (month == 5 && day >= 23)) {
} else if ((month == 6 && day < 22) || (month == 5 && day >= 21)) {
return 'Gêmeos';
} else if ((month == 7 && day < 23) || (month == 6 && day >= 22)) {
return 'Cancer';
} else if ((month == 8 && day < 23) || (month == 7 && day >= 21)) {
} else if ((month == 8 && day < 23) || (month == 7 && day >= 23)) {
return 'Leao';
} else if ((month == 9 && day < 23) || (month == 8 && day >= 20)) {
} else if ((month == 9 && day < 23) || (month == 8 && day >= 23)) {
return 'Virgo';
} else if ((month == 10 && day < 24) || (month == 9 && day >= 21)) {
} else if ((month == 10 && day < 24) || (month == 9 && day >= 22)) {
return 'Libra';
} else if ((month == 11 && day < 22) || (month == 10 && day >= 19)) {
} else if ((month == 11 && day < 22) || (month == 10 && day >= 24)) {
return 'Escorpião';
} else if ((month == 12 && day < 22) || (month == 11 && day >= 20)) { return 'Sagitário' }
} else if ((month == 12 && day < 22) || (month == 11 && day >= 22)) { return 'Sagitário' }
throw new Error("Signo não encontrado : " + day + '/' + month);
}

@@ -91,0 +92,0 @@

@@ -66,15 +66,15 @@ "use strict";

}
else if ((month == 2 && day < 19) || (month == 1 && day >= 22)) {
else if ((month == 2 && day < 19) || (month == 1 && day >= 20)) {
return 'Aquários';
}
else if ((month == 3 && day < 21) || (month == 2 && day >= 24)) {
else if ((month == 3 && day < 21) || (month == 2 && day >= 19)) {
return 'Peixes';
}
else if ((month == 4 && day < 20) || (month == 3 && day >= 23)) {
else if ((month == 4 && day < 20) || (month == 3 && day >= 21)) {
return 'Aries';
}
else if ((month == 5 && day < 21) || (month == 4 && day >= 23)) {
else if ((month == 5 && day < 21) || (month == 4 && day >= 20)) {
return 'Touro';
}
else if ((month == 6 && day < 22) || (month == 5 && day >= 23)) {
else if ((month == 6 && day < 22) || (month == 5 && day >= 21)) {
return 'Gêmeos';

@@ -85,17 +85,18 @@ }

}
else if ((month == 8 && day < 23) || (month == 7 && day >= 21)) {
else if ((month == 8 && day < 23) || (month == 7 && day >= 23)) {
return 'Leao';
}
else if ((month == 9 && day < 23) || (month == 8 && day >= 20)) {
else if ((month == 9 && day < 23) || (month == 8 && day >= 23)) {
return 'Virgo';
}
else if ((month == 10 && day < 24) || (month == 9 && day >= 21)) {
else if ((month == 10 && day < 24) || (month == 9 && day >= 22)) {
return 'Libra';
}
else if ((month == 11 && day < 22) || (month == 10 && day >= 19)) {
else if ((month == 11 && day < 22) || (month == 10 && day >= 24)) {
return 'Escorpião';
}
else if ((month == 12 && day < 22) || (month == 11 && day >= 20)) {
else if ((month == 12 && day < 22) || (month == 11 && day >= 22)) {
return 'Sagitário';
}
throw new Error("Signo não encontrado : " + day + '/' + month);
}

@@ -102,0 +103,0 @@ exports.getAstro = getAstro;

@@ -258,3 +258,4 @@ "use strict";

},
number: function (numberValue) {
number: function (numberValue, decimalsFormat) {
if (decimalsFormat === void 0) { decimalsFormat = 2; }
if (!numberValue) {

@@ -273,6 +274,6 @@ return '';

var decimals = vals.length > 1 ? (vals[1] < 10 ? vals[1].toString() + '0' : vals[1].toString()) : '00';
if (decimals.length > 2) {
decimals = decimals.substring(0, 2);
if (decimals.length > decimalsFormat) {
decimals = decimals.substring(0, decimalsFormat);
}
return conformToMask(numberValue, mask, { guide: false }).conformedValue + ',' + decimals;
return conformToMask(numberValue, mask, { guide: false }).conformedValue + (decimalsFormat > 0 ? ',' + decimals : '');
},

@@ -279,0 +280,0 @@ porcentagem: function (porcentagemValue) {

@@ -89,27 +89,2 @@ "use strict";

});
it('Moeda', function () {
var currency = 'R$ 5.103,94';
var currencyText = '5.103,94';
var currencyNumber = 5103.94;
var currencyNoDecimals = 'R$ 5.103';
var currencyTextNoDecimals = '5.103';
var currencyNumberNoDecimals = 5103;
var currencyNumberMany = 5103.9423234;
var currencyTextNegative = '-5.103,94';
var currencyNumberNegative = -125.95;
var currencyNegative = '-R$ 5.103,94';
chai_1.expect(index_1.maskBr.currency(currencyNoDecimals)).to.be.equal('R$ 5.103,00');
chai_1.expect(index_1.maskBr.currency(currencyTextNoDecimals)).to.be.equal('R$ 5.103,00');
chai_1.expect(index_1.maskBr.currency(currencyNumberNoDecimals)).to.be.equal('R$ 5.103,00');
chai_1.expect(index_1.maskBr.currency(currency)).to.be.equal('R$ 5.103,94');
chai_1.expect(index_1.maskBr.currency(currencyNumber)).to.be.equal('R$ 5.103,94');
chai_1.expect(index_1.maskBr.currency(currencyText)).to.be.equal('R$ 5.103,94');
chai_1.expect(index_1.maskBr.currency(currencyNumberMany)).to.be.equal('R$ 5.103,94');
chai_1.expect(index_1.maskBr.currency(currencyTextNegative)).to.be.equal('-R$ 5.103,94');
chai_1.expect(index_1.maskBr.currency(currencyNumberNegative)).to.be.equal('-R$ 125,95');
chai_1.expect(index_1.maskBr.currency(currencyNegative)).to.be.equal('-R$ 5.103,94');
// testGeneric('currency');
// expect(maskBr.currency('123')).to.exist;
// expect(maskBr.currency(123)).to.exist;
});
it('DATA', function () {

@@ -143,3 +118,33 @@ var data = '01/12/1980';

chai_1.expect(index_1.maskBr.number(1234.10)).to.be.equal('1.234,10');
chai_1.expect(index_1.maskBr.number(1234, 0)).to.be.equal('1.234');
chai_1.expect(index_1.maskBr.number(1234.56, 1)).to.be.equal('1.234,5');
chai_1.expect(index_1.maskBr.number(1234.56, 2)).to.be.equal('1.234,56');
chai_1.expect(index_1.maskBr.number(1234.565, 3)).to.be.equal('1.234,565');
chai_1.expect(index_1.maskBr.number(1234.5656, 4)).to.be.equal('1.234,5656');
});
it('Moeda', function () {
var currency = 'R$ 5.103,94';
var currencyText = '5.103,94';
var currencyNumber = 5103.94;
var currencyNoDecimals = 'R$ 5.103';
var currencyTextNoDecimals = '5.103';
var currencyNumberNoDecimals = 5103;
var currencyNumberMany = 5103.9423234;
var currencyTextNegative = '-5.103,94';
var currencyNumberNegative = -125.95;
var currencyNegative = '-R$ 5.103,94';
chai_1.expect(index_1.maskBr.currency(currencyNoDecimals)).to.be.equal('R$ 5.103,00');
chai_1.expect(index_1.maskBr.currency(currencyTextNoDecimals)).to.be.equal('R$ 5.103,00');
chai_1.expect(index_1.maskBr.currency(currencyNumberNoDecimals)).to.be.equal('R$ 5.103,00');
chai_1.expect(index_1.maskBr.currency(currency)).to.be.equal('R$ 5.103,94');
chai_1.expect(index_1.maskBr.currency(currencyNumber)).to.be.equal('R$ 5.103,94');
chai_1.expect(index_1.maskBr.currency(currencyText)).to.be.equal('R$ 5.103,94');
chai_1.expect(index_1.maskBr.currency(currencyNumberMany)).to.be.equal('R$ 5.103,94');
chai_1.expect(index_1.maskBr.currency(currencyTextNegative)).to.be.equal('-R$ 5.103,94');
chai_1.expect(index_1.maskBr.currency(currencyNumberNegative)).to.be.equal('-R$ 125,95');
chai_1.expect(index_1.maskBr.currency(currencyNegative)).to.be.equal('-R$ 5.103,94');
// testGeneric('currency');
// expect(maskBr.currency('123')).to.exist;
// expect(maskBr.currency(123)).to.exist;
});
it('Porcentagem', function () {

@@ -146,0 +151,0 @@ var porcentagem = '80';

{
"name": "js-brasil",
"version": "2.3.8",
"version": "2.3.9",
"description": "Javascript Utils para Brasil (cpf, cnpj...)",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

@@ -286,3 +286,3 @@ import { isArray, processCaretTraps, getSpecialProperty } from './utils';

},
number: (numberValue: any) => {
number: (numberValue: any, decimalsFormat: number = 2) => {
if (!numberValue) {

@@ -305,4 +305,4 @@ return '';

let decimals = vals.length > 1 ? (vals[1] < 10 ? vals[1].toString() + '0' : vals[1].toString()) : '00';
if (decimals.length > 2) {
decimals = decimals.substring(0, 2);
if (decimals.length > decimalsFormat) {
decimals = decimals.substring(0, decimalsFormat);
}

@@ -314,3 +314,3 @@

{ guide: false }
).conformedValue + ',' + decimals;
).conformedValue + (decimalsFormat > 0 ? ',' + decimals : '');
},

@@ -317,0 +317,0 @@ porcentagem: (porcentagemValue: string) => {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

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 too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc