Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #29770

Re: JavaScript validation with JOVIAL.js extended

Newsgroups comp.lang.javascript
Date 2016-03-02 06:29 -0800
References <04890f32-c4d8-48e1-bf60-d0e4f71e7d9a@googlegroups.com> <efc6ea06-a541-48e3-b369-955e9dac55c3@googlegroups.com>
Message-ID <b749b499-5576-4e58-ac31-cfe9a59c4ea7@googlegroups.com> (permalink)
Subject Re: JavaScript validation with JOVIAL.js extended
From Simon Blackwell <syblackwell@anywhichway.com>

Show all headers | View raw


On Tuesday, March 1, 2016 at 8:37:41 PM UTC-5, Michael Haufe (TNO) wrote:
> On Tuesday, March 1, 2016 at 11:39:24 AM UTC-6, Simon Blackwell wrote:
> > JOVIAL the light weight JavaScript object validation library has been enhanced to support validation of email, ISBN, credit card (CC), and IP address (IP). Extending the type checking requires just one line of code per type. In addition, default values and write once support have been added.
> > 
> > https://github.com/anywhichway/jovial
> 
> 
> A five second glance raises the following issue:
> 
> #1 you are using a regex to validate credit card numbers:
> 
> /^3(?:[47]\d([ -]?)\d{4}(?:\1\d{4}){2}|0[0-5]\d{11}|[68]\d{12})$|^4(?:\d\d\d)?([ -]?)\d{4}(?:\2\d{4}){2}$|^6011([ -]?)\d{4}(?:\3\d{4}){2}$|^5[1-5]\d\d([ -]?)\d{4}(?:\4\d{4}){2}$|^2014\d{11}$|^2149\d{11}$|^2131\d{11}$|^1800\d{11}$|^3\d{15}$/
> 
> This is a valid CC number: 6372178847694560
> This is NOT a valid CC number: 6372178847694506
> 
> Compare your approach to the use of the Luhn Formula.

Thanks for your input. JOVIAL will be updated to use the Luhn Formula in a release scheduled for next week. This extension will be done in a manner such that functions rather than RegExp can be an alternate general means of extending types.

Back to comp.lang.javascript | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

JavaScript validation with JOVIAL.js extended Simon Blackwell <syblackwell@anywhichway.com> - 2016-03-01 09:39 -0800
  Re: JavaScript validation with JOVIAL.js extended "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2016-03-01 17:37 -0800
    Re: JavaScript validation with JOVIAL.js extended Simon Blackwell <syblackwell@anywhichway.com> - 2016-03-02 06:29 -0800
    Re: JavaScript validation with JOVIAL.js extended John Harris <niam@jghnorth.org.uk.invalid> - 2016-03-02 15:23 +0000
    Re: JavaScript validation with JOVIAL.js extended Simon Blackwell <syblackwell@anywhichway.com> - 2016-03-03 04:33 -0800

csiph-web