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

us-bank-account-validator

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

us-bank-account-validator

A library for validating US Bank Account routing and account numbers

  • 1.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
6K
increased by6.44%
Maintainers
1
Weekly downloads
 
Created
Source

US Bank Account Validator

US Bank Account Validator provides validation utilities for US bank routing and account numbers. It includes first-class support for "potential" validity so you can use it to present appropriate UI to your user as they type.

Installation

You can install us-bank-account-validator through npm.

npm install us-bank-account-validator

Example

In Node/Webpack/Browserify:

var valid = require("us-bank-account-validator");

var routingValidation = valid.routingNumber("4111");

if (routingValidation.isValid) {
  renderFullyValidRoutingNumber();
} else if (!routingValidation.isPotentiallyValid) {
  renderInvalidRoutingNumber();
}

In the browser with <script> tags:

<script src="path/to/us-bank-account-validator.js"></script>
<script>
  var accountValidation = valid.accountNumber("4111");

  if (accountValidation.isValid) {
    renderFullyValidAccountNumber();
  } else if (!accountValidation.isPotentiallyValid) {
    renderInvalidAccountNumber();
  }
</script>

API

valid.routingNumber(value: string): object

Will return something like this:

{
  // if false, indicates there is no way the number could be valid
  isPotentiallyValid: true,

  // if true, number is fully valid for submission
  isValid: false
}

Valid routing numbers come from a hard-coded list of possible numbers, which you can find in src/routing-number-list.js.

valid.accountNumber(value: string): object

Will return something like this:

{
  // if false, indicates there is no way the number could be valid
  isPotentiallyValid: true,

  // if true, number is fully valid for submission
  isValid: false
}

Valid account numbers are strings between 4 and 17 characters. They are usually numeric but not always, which is why this is a simple length check.

FAQs

Package last updated on 05 Dec 2023

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