Repository: baianat/vee-validate (js)

Issue:
Arabic numerals aren't considered numerals
#### Versions:
- VueJs: #.#.#
- Vee-Validate:

### Description:
when typing arabic numerals '٠١٢٣٤٥٦٧٨٩' in a field that has numerical validation it's not accepted.

I would appreciate it if someone knows a way around this.


Pull request description:
feat: added arabic numerics to the numeric rule
This adds basic Arabic numeric support to the `numeric` rule

closes #695


Patch:
diff --git a/src/rules/numeric.js b/src/rules/numeric.js
index 323267db..6c22e4e6 100644
--- a/src/rules/numeric.js
+++ b/src/rules/numeric.js
@@ -1,9 +1,19 @@
+
+const ar = /^[٠١٢٣٤٥٦٧٨٩]+$/;
+const en = /^[0-9]+$/;
+
 const validate = (value) => {
+  const testValue = val => {
+    const strValue = String(val);
+
+    return en.test(strValue) || ar.test(strValue);
+  };
+
   if (Array.isArray(value)) {
-    return value.every(val => /^[0-9]+$/.test(String(val)));
+    return value.every(testValue);
   }
 
-  return /^[0-9]+$/.test(String(value));
+  return testValue(value);
 };
 
 export {


Test patch:
diff --git a/tests/unit/rules/numeric.js b/tests/unit/rules/numeric.js
index aab4de17..b8f1abbf 100644
--- a/tests/unit/rules/numeric.js
+++ b/tests/unit/rules/numeric.js
@@ -2,7 +2,9 @@ import { validate } from '@/rules/numeric';
 
 const valid = [
   '1234567890',
-  123
+  123,
+  '٠١٢٣٤',
+  '٠١٢٣٤٥٦٧٨٩'
 ];
 
 const invalid = [
@@ -18,7 +20,6 @@ const invalid = [
 ];
 
 test('validates that the string only contains numeric characters', () => {
-  expect.assertions(13);
   // valid.
   valid.forEach(value => expect(validate(value)).toBe(true));
   expect(validate(valid)).toBe(true);