Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

@pacely/vatsearch

pacelyapp27MIT2.1.4TypeScript support: included

Search for company records in all Nordic countries.

brreg, cvr, ytj, pacely

readme

@pacely/vatsearch

npm version npm downloads License

Search for company records in all Nordic countries ⚡️

Features

  • 👌  Search for all companies in Norway, Denmark, Sweden and Finland
  • ⚡  Get opinionated Risk Analysis on all companies

Quick Setup

Add @pacely/vatsearch dependency to your project

# Using npm
npm install @pacely/vatsearch

# Using yarn
yarn add @pacely/vatsearch

Usage

import VatSearch, { VatRegister, Company } from "@pacely/vatsearch";

// Initialize the parser
const vatsearch = new VatSearch({ register: VatRegister.NO }).parser()

// Get all companies (Only available for NO)
vatsearch.all().then((response: Company[]) => {
    console.log(response)
})

// Search for a company by name
vatsearch.find('Hirvi AS').then((response: Company[]) => {
    console.log(response)
})

// Get a single company by VATID/Organization identifier
vatsearch.get(10150817).then((response: Company) => {
    console.log(response)
})

Response

The response object contains the following and is the same for all registers

interface Company {
    vatid: string | number;
    name: string;
    dateStarted: string;
    employees: number | string;
    companyType: string;
    address: CompanyAddress;
    website: string;
    bankrupt: boolean | string | 'not_available';
    contact: CompanyContact | string | 'not_available';
    risk: RiskAnalyses;
    [x: string]: any;
}

interface CompanyAddress {
    address: string;
    zip: number;
    place: string;
    municipal?: string;
    country: string;
}

interface CompanyContact {
    phone?: string | number;
    email?: string;
    fax?: string | number;
}

interface RiskAnalyses {
    score: number
    risks: {
        [x: string]: any;
    }[]
    info: string
}

Configuration

This package takes a single configuration while initializing. The register flag tells it what API to use for your request.

const vatsearch = new VatSearch({
    register: 'NO' // NO, DK, SV, FI
})

You can change the configuration afterwards by doing vatsearch.setOptions(options).

License

MIT License

Copyright (c) HIRVI AS

changelog

Changelog

All notable changes to this project will be documented in this file. See standard-version for commit guidelines.

2.1.4 (2021-06-16)

Bug Fixes

  • parser: 'URLSearchParams' is defined but never used (19ad3a8)
  • parser: Fixed param parser (fcdcfe9)

2.1.3 (2021-06-16)

Bug Fixes

2.1.2 (2021-06-16)

Bug Fixes

  • Fixed typings. Now includes interfaces (b76a594)
  • Rollback to es2018 (91dd6d7)

2.1.1 (2021-06-16)

2.1.0 (2021-06-16)

Features

  • Provide method for updating config on the fly. (2fa3323)

2.0.1 (2021-06-15)