npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details


  • User packages



Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.


Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner




Typescript library with utility functions for a bunch of numbers





Typescript library with utility functions for a bunch of numbers:

  • Norwegian account number validation
  • Norwegian organization number validation
  • Norwegian nin validation (supports D-numbers, H-numbers and 'synthetic nin' from the Norwegian Population Registry ( Folkeregisteret))
  • KID number validation


npm i --save @halloverden/number-utilities-ts

The NinEntity

The NinEntity expects a valid nin, and will throw an error if the given nin is invalid. If you want to validate a nin without trying to create an instance of NinEntity, use the validateNin function instead.

try {
  let nin = new NinEntity('12345678912');
} catch (e) {
  // invalid nin

// Get the nin type (see NinTypeEnum)

// Get the nin as a string

// Check nin is of the regular type

// Check if nin is D-number

// Check if nin is H-number

// Check if nin is of the synthetic type

// Check if nin is male-pattern

// Check if nin is female-pattern

The NinTypeEnum

Types of nin that are supported by the package

Standalone functions

The package comes with a bunch of standalone utility functions. See the type declaration files for documentation.

  • checkDate(year: number, month: number, day: number): boolean
  • checkLuhnControlDigit(input: string): boolean
  • checkLuhnControlDigits(input: string, numberOfDigits: number): boolean
  • generateEveryNinForDate(date: Date): NinListEntity
  • getBirthDateFromNin(ninEntity: NinEntity): Date
  • getDayFromNin(ninEntity: NinEntity): number
  • getDefaultMod11WeightsForLength(length: number): number[]
  • getIndRangesFromYear(year: number, type: NinTypeEnum = NinTypeEnum.TYPE_REGULAR_NIN): IndRange[]
  • getLuhnControlDigit(input: string): number
  • getLuhnControlDigits(input: string, numberOfDigits: number): number[]
  • getMod11ControlDigit(input: string, weights: number[], acceptedRemainders = [0], onRemainder1 = '-'): string
  • getMod11ControlDigits(input: string, numberOfDigits: number, throwIfOne = true): string[]
  • getMonthFromNin(ninEntity: NinEntity): number
  • getNinIndividualNumberRangeMappingTypesFromInd(ind: number, type: NinTypeEnum = NinTypeEnum.TYPE_REGULAR_NIN): NinIndividualNumberRangeMappingType[]
  • getRandomNinForDate(date: Date, type: NinTypeEnum = NinTypeEnum.TYPE_REGULAR_NIN): NinEntity
  • getRandomNumberFromRange(min: number, max: number): number
  • getYearFromNin(nin: string): number
  • getYearFromNinEntity(ninEntity: NinEntity): number
  • getYearRangesFromInd(ind: number, type: NinTypeEnum = NinTypeEnum.TYPE_REGULAR_NIN): YearRange[]
  • isDNumberPattern(nin: string): boolean
  • isFemaleNinPattern(nin: string): boolean
  • isHNumberPattern(nin: string): boolean
  • isMaleNinPattern(nin: string): boolean
  • isNinPattern(nin: string): boolean
  • isNprSyntheticNinPattern(nin: string): boolean
  • isRegularNinPattern(nin: string): boolean
  • validateAccountNumber(accountNumber: string): boolean
  • validateKidNumber(kidNumber: string): boolean
  • validateNin(nin: string): boolean
  • validateOrganizationNumber(orgNumber: string): boolean
  • zeroPadding(value: string, length = 2): string

Test & build

Test with npm run test

Build with npm run build