ng-luhn

WebJar for ng-luhn

License

License

MIT
GroupId

GroupId

org.webjars.bower
ArtifactId

ArtifactId

ng-luhn
Last Version

Last Version

1.0.0
Release Date

Release Date

Type

Type

jar
Description

Description

ng-luhn
WebJar for ng-luhn
Project URL

Project URL

http://webjars.org
Source Code Management

Source Code Management

https://github.com/leodido/ng-luhn

Download ng-luhn

How to add to project

<!-- https://jarcasting.com/artifacts/org.webjars.bower/ng-luhn/ -->
<dependency>
    <groupId>org.webjars.bower</groupId>
    <artifactId>ng-luhn</artifactId>
    <version>1.0.0</version>
</dependency>
// https://jarcasting.com/artifacts/org.webjars.bower/ng-luhn/
implementation 'org.webjars.bower:ng-luhn:1.0.0'
// https://jarcasting.com/artifacts/org.webjars.bower/ng-luhn/
implementation ("org.webjars.bower:ng-luhn:1.0.0")
'org.webjars.bower:ng-luhn:jar:1.0.0'
<dependency org="org.webjars.bower" name="ng-luhn" rev="1.0.0">
  <artifact name="ng-luhn" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.webjars.bower', module='ng-luhn', version='1.0.0')
)
libraryDependencies += "org.webjars.bower" % "ng-luhn" % "1.0.0"
[org.webjars.bower/ng-luhn "1.0.0"]

Dependencies

compile (1)

Group / Artifact Type Version
org.webjars.bower : angular jar [1.3.0,1.4)

Project Modules

There are no modules declared in this project.

Luhn algorithm

Bower Travis branch

AngularJS service exposing the fastest implementation of Luhn algorithm.

Usefult to check check credit card numbers validity or generally to verify card numbers generated via this algorithm.

Closurized, less than 500 bytes.

Instructions

The luhn service is a constructor with only a (privileged) method (i.e., check()).

Using it is very simple.

  1. Load AngularJS and this little library

    <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular.min.js"></script>
    <script src="https://cdn.rawgit.com/leodido/ng-luhn/master/luhn.min.js"></script>
  2. Declare your AngularJS application with leodido.luhn in the dependencies array

    var app = angular.module('myModule', ['leodido.luhn']);
  3. Inject the service into you AngularJS code and call its check method

    app.controller('NumberController', ['luhn', function(luhn) {
      var isValid = luhn.check('49927398716'); 
    }]);

NOTE

Do not forget to bootstrap your AngularJS application ...

Install

Install it via bower.

bower install ng-luhn

Otherwise you can grab *.luhn.js file/s in the repository root or use rawgit.

References

  • Fastest? Yes, check yourself: jsperf.

Analytics

Versions

Version
1.0.0