Skip to content

A javascript micro library for validating and creating Finnish business ids (y-tunnus, alv-numero)

License

Notifications You must be signed in to change notification settings

vkomulai/finnish-business-ids

Repository files navigation

Finnish business id and vat number validator/generator

Build Status 0 deps Downloads License

  • A micro library for validating and creating Finnish business ids (y-tunnus, alv-numero)
  • Lightweight, less than 10kb
  • No dependencies
  • Written in Typescript, typescript types available out-of-the-box

Installation

# NPM
npm install finnish-business-ids --save

# yarn 
yarn add finnish-business-ids

Usage

Node.js

Javascript

const { FinnishBusinessIds } = require('finnish-business-ids')

const validId = FinnishBusinessIds.isValidBusinessId('2617416-4')
console.log('validId:', validId)

Typescript

import { FinnishBusinessIds } from 'finnish-business-ids'

const validId: boolean = FinnishBusinessIds.isValidBusinessId('2617416-4')
console.log('validId:', validId)

Examples

Functions

isValidBusinessId(businessId: string) : boolean
  • Validates parameter given business id (y-tunnus), format: 1234567-8
isValidVatNumber(vatNumber: string) : boolean
  • Validates parameter given Finnish vat number (alv-numero), format: FI12345678
generateBusinessId() : string
  • Generates a random Finnish business id
generateVatNumber() : string
  • Generates a random Finnish vat number
calculateChecksum(idNumbers: string) : number
  • Calculates checksum for parameter given business id without checksum, format: 1234567

Changelog

CHANGELOG

Building

# Build a distributable minified library
npm run dist

# Run linter
npm run lint

# Run tests
npm run test

Release a new version

License

MIT License

About

A javascript micro library for validating and creating Finnish business ids (y-tunnus, alv-numero)

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •