From 4e8827b39474db8db26e9fe23b56592be4d7d102 Mon Sep 17 00:00:00 2001 From: Sarah Ryan Date: Thu, 26 May 2016 17:36:24 -0700 Subject: [PATCH] Allow prepended zeroes in toInt() --- src/lib/isInt.js | 2 +- test/validators.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/lib/isInt.js b/src/lib/isInt.js index 7d4204410..d49f55ea2 100644 --- a/src/lib/isInt.js +++ b/src/lib/isInt.js @@ -1,6 +1,6 @@ import assertString from './util/assertString'; -const int = /^(?:[-+]?(?:0|[1-9][0-9]*))$/; +const int = /^[-+]?[0-9]+$/; export default function isInt(str, options) { assertString(str); diff --git a/test/validators.js b/test/validators.js index d933ca146..2a68015e3 100644 --- a/test/validators.js +++ b/test/validators.js @@ -890,11 +890,11 @@ describe('Validators', function () { '123', '-0', '+1', - ], - invalid: [ '01', '-01', '000', + ], + invalid: [ '100e10', '123.123', ' ',