Socket
Socket
Sign inDemoInstall

cusip_style_luhn_mod_n

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cusip_style_luhn_mod_n

CUSIP-style luhn mod N


Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Weekly downloads
 
Created
Source

cusip_style_luhn_mod_n CircleCI Gem Version npm version

CUSIP-style luhn mod N algorithm based on https://commons.apache.org/proper/commons-validator/apidocs/org/apache/commons/validator/routines/checkdigit/CUSIPCheckDigit.html and https://en.wikipedia.org/wiki/Luhn_mod_N_algorithm

Installation

Ruby:

Add this line to your application's Gemfile and run bundle:

gem 'cusip_style_luhn_mod_n'
JavaScript:
npm i cusip_style_luhn_mod_n --save

Usage

Ruby:
# Check validity of check digit:
CUSIPStyleLuhnModN.valid?("A1B2C5")
=> true

CUSIPStyleLuhnModN.valid?("A1B2C4")
=> false

# Generate check digit
CUSIPStyleLuhnModN.check_digit("A1B2C")
=> 5
JavaScript:
// Check validity of check digit:
CUSIPStyleLuhnModN.isValid("A1B2C5")
=> true

CUSIPStyleLuhnModN.isValid("A1B2C4")
=> false

// Generate check digit
CUSIPStyleLuhnModN.checkDigit("A1B2C")
=> 5

Development

After checking out the repo, run bin/setup to install dependencies. Then, run rake spec to run the tests. You can also run bin/console for an interactive prompt that will allow you to experiment.

To install this gem onto your local machine, run bundle exec rake install. To release a new version, update the version number in version.rb, and then run bundle exec rake release, which will create a git tag for the version, push git commits and tags, and push the .gem file to rubygems.org.

FAQs

Package last updated on 03 Oct 2017

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