1.0.3 • Published 4 years ago

@konfirm/is-sepa v1.0.3

Weekly downloads
1
License
MIT
Repository
-
Last release
4 years ago

is-sepa

Determine whether an iso3166 region code or an iso13616 IBAN country code is part of SEPA (Single Euro Payments Area).

Installation

The is-sepa package is a scoped package, which means one needs to provide the scope (both in installation and use).

$ npm install --save @konfirm/is-sepa

Usage

isSEPA

The package exposes a function which will provide a boolean value on whether the supplied iso3166 regions code(s) and/or provided iso13616 (IBAN) code(s) are present in SEPA.

const isSEPA = require('@konfirm/is-sepa');

console.log(isSEPA('NL')); //  true
console.log(isSEPA('US')); //  false

If multiple iso3166/iso13616 codes are provided, the validation will return true only if all codes are part of SEPA.

const isSEPA = require('@konfirm/is-sepa');

console.log(isSEPA('NL', 'BE', 'LU')); //  true
console.log(isSEPA('NL', 'BE', 'LU', 'US')); //  false

match

As part of the isSEPA function, a match method is provided, which will return the requested SEPA Region object.

const isSEPA = require('@konfirm/is-sepa');
const match = isSEPA.match('GB'); //  returns the RegionGB object, representing the United Kingdom

This also works for subdivision matching

const isSEPA = require('@konfirm/is-sepa');
const match = isSEPA.match('JE'); //  returns the RegionJE object, representing Jersey (a subdivision of the United Kingdom)

SEPARegion

The SEPARegion object consists of the following structure

membertypedescription
iso3166stringthe iso3166 region code
iso13616stringthe iso13616 IBAN code (this may be different from the iso3166 code)
regionsSEPARegionsubdivisions, if any
sinceDatethe date on which SEPA was first available in the region
Symbol.matchfunctionAllow for use as String.match argument, returning the appropriate SEPA Region if it matches (this includes subdivisions)
SEPARegion matching example
//
const { GB } = require('@konfirm/is-sepa');
const match = 'IM'.match(GB); // returns the RegionIM object, representing the Isle of Man

The result is no different from using match on the isSEPA module.

exported regions

The 36 SEPA regions are exported directly, any subdivision participating in SEPA is available using matching are provided by the containing regions.

The table below summarizes which iso3166 codes are available on the is-sepa module and can be used directly.

const { FR } = require('@konfirm/is-sepa');
iso3166countryincludes
ADAndorra
ATAustria
BEBelgium
BGBulgaria
CHSwitzerland
CYCyprus
CZCzech Republic
DEGermany
DKDenmark
EEEstonia
ESSpain(Canary Islands)
FIFinlandAX
FRFranceBL, GF, GP, MF, MQ, PM, RE, YT
GBUnited KingdomGG, GI, IM, JE
GRGreece
HRCroatia
HUHungary
IEIreland
ISIceland
ITItaly
LILiechtenstein
LTLithuania
LULuxembourg
LVLatvia
MCMonaco
MTMalta
NLNetherlands
NONorway
PLPoland
PTPortugal(Azores, Madeira)
RORomania
SESweden
SISlovenia
SKSlovakia
SMSan Marino
VAVatican City State

The full subdivision names indicate they are explicitly mentioned in the SEPA documentation, but do not provide an iso3166 code of their own

The subdivision SEPARegion objects can only be accessed through their containing regions, or through match

iso3166countryincluded by
AXÅland IslandsFI
BLSaint BarthélemyFR
GFFrench GuianaFR
GGGuernseyGB
GIGibraltarGB
GPGuadeloupeFR
IMIsle of ManGB
JEJerseyGB
MFSaint Martin (French part)FR
MQMartiniqueFR
PMSaint Pierre and MiquelonFR
RERéunionFR
YTMayotteFR

License

MIT License Copyright (c) 2019 Rogier Spieker (Konfirm)

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

1.0.3

4 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago