german-tax-id-validator
TypeScript icon, indicating that this package has built-in type declarations

1.0.6 • Public • Published

German Tax Id Validator

This library validates german tax identification numbers, more infos here: http://www.bzst.de/EN/Steuern_National/Steueridentifikationsnummer/steuerid_node.html. No dependencies, very small - 1KB minified, 551B Minified + gzipped (see bundlephobia.com).

I originally developed this while working at LIQID, but they made the repository private. This code is the one exported from the npm package. MIT licensed.

How to use

First you neeed to install the package via npm:

npm install --save german-tax-id-validator

CommonJS:

const taxValidator = require('german-tax-id-validator');

const isValid = taxValidator.validate('01234567811');

ESM:

import taxValidator from 'german-tax-id-validator';

const isValid = taxValidator.validate('01234567811');

The validate-method accepts only strings;

You can further specify wich versions of valid tax-ids you want to test, because since 2016, another set of tax-ids is valid. You can use the optional parameters to test for a specific version of the tax-id.

// only validate pre 2016-ids
const isValid = taxValidator.validate('01234567811', false, true);
// only validate post 2016-ids
const isValid = taxValidator.validate('01234567811', true, false);

Package Sidebar

Install

npm i german-tax-id-validator

Weekly Downloads

2,651

Version

1.0.6

License

MIT

Unpacked Size

12.7 kB

Total Files

7

Last publish

Collaborators

  • tom.n1ck