init
This commit is contained in:
31
node_modules/qrcode/lib/core/regex.js
generated
vendored
Normal file
31
node_modules/qrcode/lib/core/regex.js
generated
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
const numeric = '[0-9]+'
|
||||
const alphanumeric = '[A-Z $%*+\\-./:]+'
|
||||
let kanji = '(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|' +
|
||||
'[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|' +
|
||||
'[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|' +
|
||||
'[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+'
|
||||
kanji = kanji.replace(/u/g, '\\u')
|
||||
|
||||
const byte = '(?:(?![A-Z0-9 $%*+\\-./:]|' + kanji + ')(?:.|[\r\n]))+'
|
||||
|
||||
exports.KANJI = new RegExp(kanji, 'g')
|
||||
exports.BYTE_KANJI = new RegExp('[^A-Z0-9 $%*+\\-./:]+', 'g')
|
||||
exports.BYTE = new RegExp(byte, 'g')
|
||||
exports.NUMERIC = new RegExp(numeric, 'g')
|
||||
exports.ALPHANUMERIC = new RegExp(alphanumeric, 'g')
|
||||
|
||||
const TEST_KANJI = new RegExp('^' + kanji + '$')
|
||||
const TEST_NUMERIC = new RegExp('^' + numeric + '$')
|
||||
const TEST_ALPHANUMERIC = new RegExp('^[A-Z0-9 $%*+\\-./:]+$')
|
||||
|
||||
exports.testKanji = function testKanji (str) {
|
||||
return TEST_KANJI.test(str)
|
||||
}
|
||||
|
||||
exports.testNumeric = function testNumeric (str) {
|
||||
return TEST_NUMERIC.test(str)
|
||||
}
|
||||
|
||||
exports.testAlphanumeric = function testAlphanumeric (str) {
|
||||
return TEST_ALPHANUMERIC.test(str)
|
||||
}
|
||||
Reference in New Issue
Block a user