Skip to content

Commit

Permalink
chore: rebuild with babel 7
Browse files Browse the repository at this point in the history
  • Loading branch information
chriso committed Oct 21, 2018
1 parent 425320c commit 0031015
Show file tree
Hide file tree
Showing 80 changed files with 1,355 additions and 1,291 deletions.
448 changes: 152 additions & 296 deletions index.js

Large diffs are not rendered by default.

42 changes: 23 additions & 19 deletions lib/alpha.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
'use strict';
"use strict";

Object.defineProperty(exports, "__esModule", {
value: true
});
var alpha = exports.alpha = {
exports.commaDecimal = exports.dotDecimal = exports.arabicLocales = exports.englishLocales = exports.decimal = exports.alphanumeric = exports.alpha = void 0;
var alpha = {
'en-US': /^[A-Z]+$/i,

This comment has been minimized.

Copy link
@rayatemukund

rayatemukund Feb 24, 2020

Need lower case as well as capital case letters , but while testing it is not validating it wont allow Capital case letter

This comment has been minimized.

Copy link
@profnandaa

profnandaa Feb 25, 2020

Member

Can open an issue with examples of what's failing? For this case, the /i covers for casing...

'bg-BG': /^[А-Я]+$/i,
'cs-CZ': /^[A-ZÁČĎÉĚÍŇÓŘŠŤÚŮÝŽ]+$/i,
Expand All @@ -30,8 +31,8 @@ var alpha = exports.alpha = {
'ku-IQ': /^[ئابپتجچحخدرڕزژسشعغفڤقکگلڵمنوۆھەیێيطؤثآإأكضصةظذ]+$/i,
ar: /^[ءآأؤإئابةتثجحخدذرزسشصضطظعغفقكلمنهوىيًٌٍَُِّْٰ]+$/
};

var alphanumeric = exports.alphanumeric = {
exports.alpha = alpha;
var alphanumeric = {
'en-US': /^[0-9A-Z]+$/i,
'bg-BG': /^[0-9А-Я]+$/i,
'cs-CZ': /^[0-9A-ZÁČĎÉĚÍŇÓŘŠŤÚŮÝŽ]+$/i,
Expand All @@ -58,34 +59,38 @@ var alphanumeric = exports.alphanumeric = {
'ku-IQ': /^[٠١٢٣٤٥٦٧٨٩0-9ئابپتجچحخدرڕزژسشعغفڤقکگلڵمنوۆھەیێيطؤثآإأكضصةظذ]+$/i,
ar: /^[٠١٢٣٤٥٦٧٨٩0-9ءآأؤإئابةتثجحخدذرزسشصضطظعغفقكلمنهوىيًٌٍَُِّْٰ]+$/
};

var decimal = exports.decimal = {
exports.alphanumeric = alphanumeric;
var decimal = {
'en-US': '.',
ar: '٫'
};

var englishLocales = exports.englishLocales = ['AU', 'GB', 'HK', 'IN', 'NZ', 'ZA', 'ZM'];
exports.decimal = decimal;
var englishLocales = ['AU', 'GB', 'HK', 'IN', 'NZ', 'ZA', 'ZM'];
exports.englishLocales = englishLocales;

for (var locale, i = 0; i < englishLocales.length; i++) {
locale = 'en-' + englishLocales[i];
locale = "en-".concat(englishLocales[i]);
alpha[locale] = alpha['en-US'];
alphanumeric[locale] = alphanumeric['en-US'];
decimal[locale] = decimal['en-US'];
}
} // Source: http://www.localeplanet.com/java/

// Source: http://www.localeplanet.com/java/
var arabicLocales = exports.arabicLocales = ['AE', 'BH', 'DZ', 'EG', 'IQ', 'JO', 'KW', 'LB', 'LY', 'MA', 'QM', 'QA', 'SA', 'SD', 'SY', 'TN', 'YE'];

var arabicLocales = ['AE', 'BH', 'DZ', 'EG', 'IQ', 'JO', 'KW', 'LB', 'LY', 'MA', 'QM', 'QA', 'SA', 'SD', 'SY', 'TN', 'YE'];
exports.arabicLocales = arabicLocales;

for (var _locale, _i = 0; _i < arabicLocales.length; _i++) {
_locale = 'ar-' + arabicLocales[_i];
_locale = "ar-".concat(arabicLocales[_i]);
alpha[_locale] = alpha.ar;
alphanumeric[_locale] = alphanumeric.ar;
decimal[_locale] = decimal.ar;
}
} // Source: https://en.wikipedia.org/wiki/Decimal_mark


// Source: https://en.wikipedia.org/wiki/Decimal_mark
var dotDecimal = exports.dotDecimal = [];
var commaDecimal = exports.commaDecimal = ['bg-BG', 'cs-CZ', 'da-DK', 'de-DE', 'el-GR', 'es-ES', 'fr-FR', 'it-IT', 'ku-IQ', 'hu-HU', 'nb-NO', 'nn-NO', 'nl-NL', 'pl-PL', 'pt-PT', 'ru-RU', 'sl-SI', 'sr-RS@latin', 'sr-RS', 'sv-SE', 'tr-TR', 'uk-UA'];
var dotDecimal = [];
exports.dotDecimal = dotDecimal;
var commaDecimal = ['bg-BG', 'cs-CZ', 'da-DK', 'de-DE', 'el-GR', 'es-ES', 'fr-FR', 'it-IT', 'ku-IQ', 'hu-HU', 'nb-NO', 'nn-NO', 'nl-NL', 'pl-PL', 'pt-PT', 'ru-RU', 'sl-SI', 'sr-RS@latin', 'sr-RS', 'sv-SE', 'tr-TR', 'uk-UA'];
exports.commaDecimal = commaDecimal;

for (var _i2 = 0; _i2 < dotDecimal.length; _i2++) {
decimal[dotDecimal[_i2]] = decimal['en-US'];
Expand All @@ -97,9 +102,8 @@ for (var _i3 = 0; _i3 < commaDecimal.length; _i3++) {

alpha['pt-BR'] = alpha['pt-PT'];
alphanumeric['pt-BR'] = alphanumeric['pt-PT'];
decimal['pt-BR'] = decimal['pt-PT'];
decimal['pt-BR'] = decimal['pt-PT']; // see #862

// see #862
alpha['pl-Pl'] = alpha['pl-PL'];
alphanumeric['pl-Pl'] = alphanumeric['pl-PL'];
decimal['pl-Pl'] = decimal['pl-PL'];
13 changes: 6 additions & 7 deletions lib/blacklist.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
'use strict';
"use strict";

Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = blacklist;

var _assertString = require('./util/assertString');

var _assertString2 = _interopRequireDefault(_assertString);
var _assertString = _interopRequireDefault(require("./util/assertString"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function blacklist(str, chars) {
(0, _assertString2.default)(str);
return str.replace(new RegExp('[' + chars + ']+', 'g'), '');
(0, _assertString.default)(str);
return str.replace(new RegExp("[".concat(chars, "]+"), 'g'), '');
}
module.exports = exports['default'];

module.exports = exports.default;
17 changes: 7 additions & 10 deletions lib/contains.js
Original file line number Diff line number Diff line change
@@ -1,22 +1,19 @@
'use strict';
"use strict";

Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = contains;

var _assertString = require('./util/assertString');
var _assertString = _interopRequireDefault(require("./util/assertString"));

var _assertString2 = _interopRequireDefault(_assertString);

var _toString = require('./util/toString');

var _toString2 = _interopRequireDefault(_toString);
var _toString = _interopRequireDefault(require("./util/toString"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function contains(str, elem) {
(0, _assertString2.default)(str);
return str.indexOf((0, _toString2.default)(elem)) >= 0;
(0, _assertString.default)(str);
return str.indexOf((0, _toString.default)(elem)) >= 0;
}
module.exports = exports['default'];

module.exports = exports.default;
11 changes: 5 additions & 6 deletions lib/equals.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
'use strict';
"use strict";

Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = equals;

var _assertString = require('./util/assertString');

var _assertString2 = _interopRequireDefault(_assertString);
var _assertString = _interopRequireDefault(require("./util/assertString"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function equals(str, comparison) {
(0, _assertString2.default)(str);
(0, _assertString.default)(str);
return str === comparison;
}
module.exports = exports['default'];

module.exports = exports.default;
11 changes: 5 additions & 6 deletions lib/escape.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
'use strict';
"use strict";

Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = escape;

var _assertString = require('./util/assertString');

var _assertString2 = _interopRequireDefault(_assertString);
var _assertString = _interopRequireDefault(require("./util/assertString"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function escape(str) {
(0, _assertString2.default)(str);
(0, _assertString.default)(str);
return str.replace(/&/g, '&amp;').replace(/"/g, '&quot;').replace(/'/g, '&#x27;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/\//g, '&#x2F;').replace(/\\/g, '&#x5C;').replace(/`/g, '&#96;');
}
module.exports = exports['default'];

module.exports = exports.default;
20 changes: 8 additions & 12 deletions lib/isAfter.js
Original file line number Diff line number Diff line change
@@ -1,26 +1,22 @@
'use strict';
"use strict";

Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = isAfter;

var _assertString = require('./util/assertString');
var _assertString = _interopRequireDefault(require("./util/assertString"));

var _assertString2 = _interopRequireDefault(_assertString);

var _toDate = require('./toDate');

var _toDate2 = _interopRequireDefault(_toDate);
var _toDate = _interopRequireDefault(require("./toDate"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function isAfter(str) {
var date = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : String(new Date());

(0, _assertString2.default)(str);
var comparison = (0, _toDate2.default)(date);
var original = (0, _toDate2.default)(str);
(0, _assertString.default)(str);
var comparison = (0, _toDate.default)(date);
var original = (0, _toDate.default)(str);
return !!(original && comparison && original > comparison);
}
module.exports = exports['default'];

module.exports = exports.default;
18 changes: 9 additions & 9 deletions lib/isAlpha.js
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
'use strict';
"use strict";

Object.defineProperty(exports, "__esModule", {
value: true
});
exports.locales = undefined;
exports.default = isAlpha;
exports.locales = void 0;

var _assertString = require('./util/assertString');
var _assertString = _interopRequireDefault(require("./util/assertString"));

var _assertString2 = _interopRequireDefault(_assertString);

var _alpha = require('./alpha');
var _alpha = require("./alpha");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function isAlpha(str) {
var locale = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'en-US';
(0, _assertString.default)(str);

(0, _assertString2.default)(str);
if (locale in _alpha.alpha) {
return _alpha.alpha[locale].test(str);
}
throw new Error('Invalid locale \'' + locale + '\'');

throw new Error("Invalid locale '".concat(locale, "'"));
}

var locales = exports.locales = Object.keys(_alpha.alpha);
var locales = Object.keys(_alpha.alpha);
exports.locales = locales;
18 changes: 9 additions & 9 deletions lib/isAlphanumeric.js
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
'use strict';
"use strict";

Object.defineProperty(exports, "__esModule", {
value: true
});
exports.locales = undefined;
exports.default = isAlphanumeric;
exports.locales = void 0;

var _assertString = require('./util/assertString');
var _assertString = _interopRequireDefault(require("./util/assertString"));

var _assertString2 = _interopRequireDefault(_assertString);

var _alpha = require('./alpha');
var _alpha = require("./alpha");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function isAlphanumeric(str) {
var locale = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'en-US';
(0, _assertString.default)(str);

(0, _assertString2.default)(str);
if (locale in _alpha.alphanumeric) {
return _alpha.alphanumeric[locale].test(str);
}
throw new Error('Invalid locale \'' + locale + '\'');

throw new Error("Invalid locale '".concat(locale, "'"));
}

var locales = exports.locales = Object.keys(_alpha.alphanumeric);
var locales = Object.keys(_alpha.alphanumeric);
exports.locales = locales;
11 changes: 5 additions & 6 deletions lib/isAscii.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
'use strict';
"use strict";

Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = isAscii;

var _assertString = require('./util/assertString');

var _assertString2 = _interopRequireDefault(_assertString);
var _assertString = _interopRequireDefault(require("./util/assertString"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

Expand All @@ -16,7 +14,8 @@ var ascii = /^[\x00-\x7F]+$/;
/* eslint-enable no-control-regex */

function isAscii(str) {
(0, _assertString2.default)(str);
(0, _assertString.default)(str);
return ascii.test(str);
}
module.exports = exports['default'];

module.exports = exports.default;
13 changes: 7 additions & 6 deletions lib/isBase64.js
Original file line number Diff line number Diff line change
@@ -1,25 +1,26 @@
'use strict';
"use strict";

Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = isBase64;

var _assertString = require('./util/assertString');

var _assertString2 = _interopRequireDefault(_assertString);
var _assertString = _interopRequireDefault(require("./util/assertString"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var notBase64 = /[^A-Z0-9+\/=]/i;

function isBase64(str) {
(0, _assertString2.default)(str);
(0, _assertString.default)(str);
var len = str.length;

if (!len || len % 4 !== 0 || notBase64.test(str)) {
return false;
}

var firstPaddingChar = str.indexOf('=');
return firstPaddingChar === -1 || firstPaddingChar === len - 1 || firstPaddingChar === len - 2 && str[len - 1] === '=';
}
module.exports = exports['default'];

module.exports = exports.default;
Loading

0 comments on commit 0031015

Please sign in to comment.