Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

kennitala

Package Overview
Dependencies
Maintainers
1
Versions
31
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

kennitala

A validator module to check the checksum of Icelandic kennitölur

  • 1.0.7
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
4.7K
increased by29.88%
Maintainers
1
Weekly downloads
 
Created
Source

Kennitala

A validator and general utility for Icelandic kennitölur in Javascript

Build Status

Installation with npm:

$ npm install kennitala

Compatible with CommonJS, AMD modules, regular Javascript.

Based off of old code, so defintiely not bullet proof, if you have a pull request it will almost definitely get accepted.

Example of usage

var kennitala = require('kennitala');

kennitala.clean('310896DIRTYSSID2099'); // '3108962099'
kennitala.clean(3108962099);            // '3108962099'

kennitala.isPerson('3108962099');            // True
kennitala.isPerson('310896-2099');           // True
kennitala.isPerson(3108962099);              // True
kennitala.isPerson('31^_^08!!96LOL20T_T99'); // True

kennitala.isCompany('6010100890');  // True
kennitala.isCompany('601010-0890'); // True
kennitala.isCompany(6010100890);    // True

API

kennitala.clean([string, int]);
    returns string

    Ensures datatype is string, then matches and removes all non-digit characters. Does not ensure the remaining string is 10 characters

kennitala.isPerson([string, int]);
    returns boolean

    Checks if kennitala checksum is correct and if day of birth is between 1-31
    If passed a string with non-digit characters included it removes them before validating

kennitala.isCompany([string, int]);
    returns boolean

    Checks if kennitala checksum is correct and if day of birth is between 41-71
    If passed a string with non-digit characters included it removes them before validating

Things to add:

Kennitala generator, for both people and companies

Unit tests for everything

FAQs

Package last updated on 06 Oct 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc