Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #29749 > unrolled thread
| Started by | Simon Blackwell <syblackwell@anywhichway.com> |
|---|---|
| First post | 2016-03-01 09:39 -0800 |
| Last post | 2016-03-03 04:33 -0800 |
| Articles | 5 — 3 participants |
Back to article view | Back to comp.lang.javascript
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
| From | Simon Blackwell <syblackwell@anywhichway.com> |
|---|---|
| Date | 2016-03-01 09:39 -0800 |
| Subject | JavaScript validation with JOVIAL.js extended |
| Message-ID | <04890f32-c4d8-48e1-bf60-d0e4f71e7d9a@googlegroups.com> |
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
[toc] | [next] | [standalone]
| From | "Michael Haufe (TNO)" <tno@thenewobjective.com> |
|---|---|
| Date | 2016-03-01 17:37 -0800 |
| Message-ID | <efc6ea06-a541-48e3-b369-955e9dac55c3@googlegroups.com> |
| In reply to | #29749 |
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.
[toc] | [prev] | [next] | [standalone]
| From | Simon Blackwell <syblackwell@anywhichway.com> |
|---|---|
| Date | 2016-03-02 06:29 -0800 |
| Message-ID | <b749b499-5576-4e58-ac31-cfe9a59c4ea7@googlegroups.com> |
| In reply to | #29752 |
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.
[toc] | [prev] | [next] | [standalone]
| From | John Harris <niam@jghnorth.org.uk.invalid> |
|---|---|
| Date | 2016-03-02 15:23 +0000 |
| Message-ID | <981edblr0t1kabce3iqa57m17vio989nts@4ax.com> |
| In reply to | #29752 |
On Tue, 1 Mar 2016 17:37:27 -0800 (PST), "Michael Haufe (TNO)" <tno@thenewobjective.com> wrote: <snip> >This is a valid CC number: 6372178847694560 <snip> That is, of course, after spaces have been removed. John
[toc] | [prev] | [next] | [standalone]
| From | Simon Blackwell <syblackwell@anywhichway.com> |
|---|---|
| Date | 2016-03-03 04:33 -0800 |
| Message-ID | <11505a12-9efb-486b-a4db-f6a4309a7950@googlegroups.com> |
| In reply to | #29752 |
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.
A new version has been posted that incorporates the Luhn Formula.
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.javascript
csiph-web