Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »

finnish-business-ids

3.1.0 • Public • Published

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

install

npm i finnish-business-ids

Downloadsweekly downloads

249

version

3.1.0

license

MIT

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability