-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
80 changed files
with
1,355 additions
and
1,291 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
profnandaa
Member
|
||
'bg-BG': /^[А-Я]+$/i, | ||
'cs-CZ': /^[A-ZÁČĎÉĚÍŇÓŘŠŤÚŮÝŽ]+$/i, | ||
|
@@ -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, | ||
|
@@ -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']; | ||
|
@@ -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']; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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, '&').replace(/"/g, '"').replace(/'/g, ''').replace(/</g, '<').replace(/>/g, '>').replace(/\//g, '/').replace(/\\/g, '\').replace(/`/g, '`'); | ||
} | ||
module.exports = exports['default']; | ||
|
||
module.exports = exports.default; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
Oops, something went wrong.
Need lower case as well as capital case letters , but while testing it is not validating it wont allow Capital case letter