Brazilian Values Versions Save

🇧🇷 Funções de formatação, conversão e validação para valores, documentos e outras unidades usadas no Brasil. Como CEP, CNPJ, CPF, BRL (R$), datas, números etc.

0.7.4

4 years ago

Minor Changes

  • Add formatToCPFOrCNPJ to formatters. It formats a string value containing numbers to CPF or CNPJ depending on its length.

    formatToCPFOrCNPJ('00000000')
    //=> '000.000.00'
    
    formatToCPFOrCNPJ('366.418.768-70')
    //=> '366.418.768-70'
    
    formatToCPFOrCNPJ('32284981000138')
    //=> '32.284.981/0001-38'
    
    formatToCPFOrCNPJ('00.0.000.00.00--00-00')
    //=> '00.000.000/0000-00'
    

    Thanks a lot to @mandala21 for PR #29 that fixed issue #28.

All the changes

https://github.com/VitorLuizC/brazilian-values/compare/0.7.3...0.7.4

0.7.3

4 years ago

Minor Changes

  • Fix unit test importing bundled module instead of the source.

  • Reduce bundle size transpiling in TS instead of Babel.

  • Create a tsconfig.bundle.json just for bundle purposes and let tsconfig.json more generic.

All the changes

https://github.com/VitorLuizC/brazilian-values/compare/0.7.2...0.7.3

0.7.2

4 years ago

Minor Changes

  • Accept 99.999-999 as valid CEP format in isCEP function.

    Thanks to @mathvaleriano for issue #26.

  • Upgrade ava to 3.1.0.

All the changes

https://github.com/VitorLuizC/brazilian-values/compare/0.7.1...0.7.2

0.7.1

4 years ago

Minor Changes

  • Add sumary to README.md docs.

    Thanks a lot to @brunosalgueiro PR #24.

  • Upgrade devDependencies and fix their breaking changes.

All the changes

https://github.com/VitorLuizC/brazilian-values/compare/0.7.0...0.7.1

0.7.0

4 years ago

Minor Changes (Features)

  • Create formatToCapitalized formatter to capitalize words in a text.

    formatToCapitalized('SERVIDOR PÚBLICO MUNICIPAL')
    //=> 'Servidor Público Municipal'
    
    formatToCapitalized('   os PrimEIROS  HOMens da tERra', {
      wordsToKeepLowerCase: ['os', 'da']
    })
    //=> 'Os Primeiros Homens da Terra'
    
    formatToCapitalized('nova tv foi lançada', {
      wordsToKeepUpperCase: ['tv']
    })
    //=> 'Nova TV Foi Lançada'
    

    Thanks a lot to @ymoreiratiti for issue #20 and PR #21.

All the changes

https://github.com/VitorLuizC/brazilian-values/compare/0.6.0...0.7.0

0.6.0

4 years ago

Minor Changes (Features)

  • Create isDDD validator to check if value is a brazilian valid DDD (direct dialing at a distance) code.

    isDDD('19')
    //=> true
    
    isDDD('23')
    //=> false
    
    isDDD('255')
    //=> false
    
  • Create isPhone validator to check if value matches common brazilian phone number, optionally with DDI, DDD and the ninth digit. If DDD is defined it'll be validated with isDDD.

    isPhone('+55 (11) 9 8273-1182')
    //=> true
    
    isPhone('11 39723768')
    //=> true
    
    isPhone('(23) 3972-3768')
    //=> false
    
    isPhone('(13) 6 5093-2093')
    //=> false
    

    Thanks to @giulianon for issue #19.

Other Changes

  • Upgrade development dependencies (ava, rollup-plugin-typescript2 and typescript).

  • Add License and bundlephobia.com badges to README.

All the changes

https://github.com/VitorLuizC/brazilian-values/compare/0.5.2...0.6.0

0.5.2

4 years ago

Fixes

  • Fixed validation strategy that ignores invalid characters on isCNPJ, isCPF and isCEP.

    Thanks to @lucasbemol for issue #18.

  • Fixed formatToDateTime TSDoc example.

Changes

  • Upgrade development dependencies (ava, rollup-plugin-typescript2 and typescript).

  • Keep consistent code style on tests.

All the changes

https://github.com/VitorLuizC/brazilian-values/compare/0.5.1...0.5.2

0.5.1

4 years ago

Fixes

  • Fixed formatToDateTime example on README (pt-BR & en).

    Thanks to @rogeriomq for PR #17.

Changes

  • Upgrade development dependencies (ava, bili, rollup-plugin-typescript2, ts-node and typescript).

0.5.0

5 years ago

Breaking Changes

  • ESM bundles were renamed (due to Bili upgrade).

    • ESM bundle dist/brazilian-values.mjs is now dist/brazilian-values.esm.js;
  • README docs are now in portuguese, but you can switch to english.

    Thanks to @g1llz for PR #12.

Minor Changes (Features)

  • Create formatToDateTime formatter to format Date instance into brazilian formatted date and time, DD/MM/YYYY HH:mm.

    new Date(1996, 2, 28, 20, 43) => '28/03/1996 20:48'
    
  • Create isCEP validator to check if value is a CEP.

    '02998-050' => true
    '912821-982' => false
    
  • Upgrade development dependencies (ava, bili, rollup-plugin-typescript2, ts-node and typescript).

All the changes

https://github.com/VitorLuizC/brazilian-values/compare/0.4.0...0.5.0

0.4.0

5 years ago

Breaking Changes

  • Bundles and the main module were renamed (due to Bili upgrade).
    • Main module index.js is now brazilian-values.js;
    • TS type definitions types/index.d.ts is now types/brazilian-values.d.ts;
    • CommonJS bundle dist/brazilian-values.cjs.js is now dist/brazilian-values.js;
    • ESM bundle dist/brazilian-values.es.js is now dist/brazilian-values.mjs;
    • UMD bundle dist/brazilian-values.js is now dist/brazilian-values.umd.js;
    • UMD minified bundle dist/brazilian-values.min.js is now dist/brazilian-values.umd.min.js;

Minor Changes (Features)

  • Create formatToNumber function to format numbers into brazilian formatted numbers.

    2289.1323 => '2.289,1323'
    
  • Create formatToList function to format arrays of string elements into brazilian formatted lists.

    ['Vitor', 'Lucas', 'Milena'] => 'Vitor, Lucas e Milena'
    
  • Create parseToNumber function to parse brazilian formatted numbers into numbers.

    '2.289,1323' => 2289.1323
    
  • Create parseToArray function to parse brazilian formatted lists into arrays of string elements.

    'Vitor, Lucas e Milena' => ['Vitor', 'Lucas', 'Milena']
    
  • Upgrade development dependencies (ava, bili, rollup-plugin-typescript2, ts-node and typescript).

  • Bili configuration was moved to its own TS module and changed to matches 4.x.x specs.

All the changes

https://github.com/VitorLuizC/brazilian-values/compare/0.3.0...0.4.0