npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

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.

About

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

belgian-vcs-ogm

v1.1.0

Published

OGM, 'overschrijving met gestructureerde mededeling', is a structured message often added to belgian bank transfers to enable automatic processing. This package enables the generation and validation of these structured messages

Downloads

76

Readme

Belgian-VCS-OGM (Belgium)

OGM, 'overschrijving met gestructureerde mededeling', is a structured message often added to belgian bank transfers to enable automatic processing. This Node package enables the generation and validation of these structured messages.

Installation

npm install belgian-vcs-ogm

Usage

var ogm = require('belgian-vcs-ogm');

Available Methods

isValidOGM(structuredMessage)

Checks whether the given structured message is a valid ogm. Validates the format and the check digits.

Parameters

  1. structuredMessage (String): structured message to check.

Return

Boolean: true if the structuredMessage is a valid ogm, false otherwise.

Example

ogm.isValidOGM('+++123/1234/12328+++');
// returns true

ogm.isValidOGM('++700/8000/90602+++');
// returns false, wrong structure

ogm.isValidOGM('++++700/8000/90607+++');
// returns false, wrong check digits

ogm.isValidOGM('+++70/0800/10029+++');
// returns false, wrong length
generateOGM(numbers)

Generates a valid OGM based on the given numbers.

Parameters

  1. numbers (String|Number): Numbers to be used to generate ogm. Length should be equal to or less than 10. only positive values are allowed.

Return

String: A valid ogm based on the given numbers. If the length of the numbers is less than 10, leading zeros are added. Two checkdigits are also added.

Example

var structuredMessage = ogm.generateOGM('0008000906');
// structuredMessage === '+++000/8000/90655+++'

var structuredMessage = ogm.generateOGM(8000906);
// structuredMessage === '+++000/8000/90655+++'

var structuredMessage = ogm.generateOGM(7008000933);
//structuredMessage === '+++700/8000/93329+++'
calculateCheckDigits(numbers)

Generates check digits for a given number. The check digits are equal to remainder of the division of the numeric value of the given numbers by 97. If the check digits are smaller than 10, a leading zero is added. If the check digit is equal to 0, 97 is used instead.

Parameters

  1. numbers (String|Number): Numbers to be used to generate checkdigits. Length should be equal to or less than 10. only positive values are allowed.

Return

String: The generated check digits

Example

var checkDigits = ogm.calculateControl(1115532822);
// checkDigits === '36'

var checkDigits = ogm.calculateControl('1115532786');
 // checkDigits === '97'
generateRandomOGM()

Generates a random structured message.

DOES NOT PREVENT COLLISION WITH PREVIOUSLY GENERATED VALUES

Parameters

none

Return

String: A randomly generated structured message, conforming to the ogm standard.

Example

var structuredMessage = ogm.generateRandomOGM();
// output is a valid structuredMessage.
getStrippedOGM(ogm)

strips +'s and /'s from the ogm. returns only the digits.

Parameters

  1. ogm (String): ogm to strip.

Return

String: Stripped ogm

Example

var stripped = ogm.getStrippedOGM('+++000/8000/90655+++');
// stripped === '000800090655'