Source: data/objects/characterCodeConstraints.js

  1. /**
  2. * simplePass - A JavaScript password generator.
  3. * Copyright (C) 2023 Jordan Vezina(staticBanter)
  4. *
  5. * This program is free software: you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation, either version 3 of the License, or
  8. * (at your option) any later version.
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with this program. If not, see <https://www.gnu.org/licenses/>.
  17. */
  18. 'use strict';
  19. import range from "../../functions/range.js";
  20. /**
  21. * @file
  22. * @module characterCodeConstraints
  23. */
  24. /**
  25. * Character-code constraint object. Defines the bounds that each character code type exists in.
  26. *
  27. * @const {characterCodeConstraintsAttributes} characterCodeConstraints
  28. * @property {characterCodeConstraintsAttributes} [lowercase] Basic Latin Lower Alpha character code constraints.
  29. * @property {characterCodeConstraintsAttributes} [uppercase] Basic Latin Upper Alpha character code constraints.
  30. * @property {characterCodeConstraintsAttributes} [numbers] Basic Latin Numeric character code constraints.
  31. * @property {characterCodeConstraintsAttributes} [punctuation] Basic Latin Punctuation character code constraints.
  32. * @property {characterCodeConstraintsAttributes} [whitespace] Whitespace character code constraint.
  33. * @property {characterCodeConstraintsAttributes} [lowercase_supplement] Basic Latin(1) Supplement Lowercase character code constraints.
  34. * @property {characterCodeConstraintsAttributes} [uppercase_supplement] Basic Latin(1) Supplement Uppercase character code constraints.
  35. * @property {characterCodeConstraintsAttributes} [symbols_supplement] Basic Latin(1) Supplement Signs, Symbols and Punctuation character code constraints.
  36. * @property {characterCodeConstraintsAttributes} [lowercase_extended_a] Latin Extended A Lowercase character code constraints.
  37. * @property {characterCodeConstraintsAttributes} [uppercase_extended_a] Latin Extended A Uppercase character code constraints.
  38. * @property {characterCodeConstraintsAttributes} [ligature_extended_a] Latin Extended A Ligature character code constraints.
  39. * @property {characterCodeConstraintsAttributes} [lowercase_extended_b] Latin Extended B Lowercase character code constraints.
  40. * @property {characterCodeConstraintsAttributes} [uppercase_extended_b] Latin Extended B Uppercase character code constraints.
  41. * @property {characterCodeConstraintsAttributes} [mixedcase_extended_b] Latin Extended B Mixed-case character code constraints.
  42. * @property {characterCodeConstraintsAttributes} [insensitivecase_extended_b] Latin Extended B Case Insensitive character code constraints.
  43. * @property {characterCodeConstraintsAttributes} [lowercase_ipa_extension] Latin IPA Lowercase character code constraints.
  44. * @property {characterCodeConstraintsAttributes} [uppercase_ipa_extension] Latin IPA Uppercase character code constraints.
  45. * @property {characterCodeConstraintsAttributes} [character_modifier_letters] Character Modifier Letter code constraints.
  46. * @property {characterCodeConstraintsAttributes} [symbol_modifier_letters] Symbol Modifier Letter code constraints.
  47. * @property {characterCodeConstraintsAttributes} [lowercase_greek_coptic] Greek Coptic Lowercase character code constraints.
  48. * @property {characterCodeConstraintsAttributes} [uppercase_greek_coptic] Greek Coptic Uppercase character code constraints.
  49. * @property {characterCodeConstraintsAttributes} [insensitivecase_greek_coptic] Greek Coptic Case Insensitive character code constraints.
  50. * @property {characterCodeConstraintsAttributes} [symbol_greek_coptic] Greek Coptic Symbol character code constraints.
  51. * @property {characterCodeConstraintsAttributes} [lowercase_cyrillic] Cyrillic Lowercase character code constraints.
  52. * @property {characterCodeConstraintsAttributes} [uppercase_cyrillic] Cyrillic Uppercase character code constraints.
  53. * @property {characterCodeConstraintsAttributes} [symbols_cyrillic] Cyrillic Symbol character code constraints.
  54. * @property {characterCodeConstraintsAttributes} [lowercase_cyrillic_supplement] Cyrillic Lowercase Supplement character code constraints.
  55. * @property {characterCodeConstraintsAttributes} [uppercase_cyrillic_supplement] Cyrillic Uppercase Supplement character code constraints.
  56. * @property {characterCodeConstraintsAttributes} [misc_cyrillic_supplement] Cyrillic Supplement Symbol character code constraints.
  57. * @property {characterCodeConstraintsAttributes} [general_punctuation] General Punctuation character code constraints.
  58. * @property {characterCodeConstraintsAttributes} [currency_symbols] Currency Symbol character code constraints.
  59. * @property {characterCodeConstraintsAttributes} [misc_technical] Miscellaneous Technical character code constraints.
  60. * @property {characterCodeConstraintsAttributes} [box_drawings] Box Drawing character code constraints.
  61. * @property {characterCodeConstraintsAttributes} [block_elements] Block Element character code constraints.
  62. * @property {characterCodeConstraintsAttributes} [misc_symbols] Miscellaneous Symbol character code constraints.
  63. * @property {characterCodeConstraintsAttributes} [dingbats] Dingbat character code constraints.
  64. * @implements {characterCodeConstraintsAttributes}
  65. * @requires range
  66. *
  67. */
  68. const characterCodeConstraints = {
  69. lowercase: {
  70. min: 97,
  71. max: 122,
  72. },
  73. uppercase: {
  74. min: 65,
  75. max: 90,
  76. },
  77. numbers: {
  78. min: 48,
  79. max: 57,
  80. },
  81. punctuation: {
  82. min: 33,
  83. max: 126,
  84. range: [
  85. [33, 47],
  86. [58, 64],
  87. [91, 96],
  88. [123, 126]
  89. ]
  90. },
  91. whitespace: {
  92. min: 32
  93. },
  94. lowercase_supplement: {
  95. min: 223,
  96. max: 255,
  97. range: [
  98. [233, 246],
  99. [248, 255]
  100. ]
  101. },
  102. uppercase_supplement: {
  103. min: 192,
  104. max: 222,
  105. range: [
  106. [192, 214],
  107. [216, 222]
  108. ]
  109. },
  110. symbols_supplement: {
  111. min: 161,
  112. max: 247,
  113. range: [
  114. [161, 191],
  115. [215],
  116. [247]
  117. ]
  118. },
  119. lowercase_extended_a: {
  120. min: 257,
  121. max: 383,
  122. range: range(257, 312, {
  123. increment: 2,
  124. exclude: [306, 307],
  125. forceInclusiveEnd: true
  126. })
  127. .concat(range(314, 329, {
  128. increment: 2,
  129. forceInclusiveEnd: true
  130. }))
  131. .concat(range(331, 375, {
  132. increment: 2,
  133. exclude: [338, 339]
  134. }))
  135. .concat(range(378, 383, {
  136. increment: 2,
  137. forceInclusiveEnd: true
  138. }))
  139. .map((element) => element = [element]),
  140. },
  141. uppercase_extended_a: {
  142. min: 256,
  143. max: 382,
  144. range: range(256, 310, {
  145. increment: 2,
  146. exclude: [306, 307]
  147. })
  148. .concat(range(313, 327, {
  149. increment: 2
  150. }))
  151. .concat(range(330, 374, {
  152. increment: 2,
  153. exclude: [338, 339]
  154. }))
  155. .concat([376])
  156. .concat(range(377, 381, {
  157. increment: 2
  158. }))
  159. .map((element) => element = [element]),
  160. },
  161. ligature_extended_a: {
  162. min: 306,
  163. max: 339,
  164. range: [
  165. [306],
  166. [307],
  167. [338],
  168. [339]
  169. ]
  170. },
  171. lowercase_extended_b: {
  172. min: 384,
  173. max: 591,
  174. range: [
  175. [384],
  176. [387],
  177. [389],
  178. [392],
  179. [396, 397],
  180. [402],
  181. [405],
  182. [409, 411],
  183. [414],
  184. [417],
  185. [419],
  186. [421],
  187. [427],
  188. [432],
  189. [436],
  190. [438],
  191. [441, 442],
  192. [445],
  193. [454],
  194. [457],
  195. [460],
  196. [496],
  197. [499],
  198. [501],
  199. [572],
  200. [589],
  201. [591],
  202. [578],
  203. [563, 569],
  204. [575, 576],
  205. [585],
  206. [587],
  207. [583]
  208. ]
  209. .concat(range(462, 476, {
  210. increment: 2
  211. }))
  212. .concat(range(479, 495, {
  213. increment: 2
  214. }))
  215. .concat(range(505, 561, {
  216. increment: 2
  217. }))
  218. },
  219. uppercase_extended_b: {
  220. min: 385,
  221. max: 590,
  222. range: [
  223. [444]
  224. ].concat(range(385, 408, {
  225. exclude: [
  226. 387,
  227. 389,
  228. 392,
  229. 396,
  230. 397,
  231. 402,
  232. 405
  233. ],
  234. singles: true
  235. }))
  236. .concat(range(412, 440, {
  237. exclude: [
  238. 414,
  239. 417,
  240. 419,
  241. 421,
  242. 422,
  243. 424,
  244. 426,
  245. 427,
  246. 429,
  247. 432,
  248. 436,
  249. 438
  250. ],
  251. singles: true,
  252. }))
  253. .concat(range(452, 458, {
  254. exclude: [
  255. 453,
  256. 454,
  257. 456,
  258. 459
  259. ],
  260. singles: true
  261. }))
  262. .concat(range(461, 475, {
  263. increment: 2,
  264. singles: true
  265. }))
  266. .concat(range(478, 494, {
  267. increment: 2,
  268. singles: true
  269. })).concat(range(497, 504, {
  270. exclude: [
  271. 498,
  272. 499,
  273. 501
  274. ],
  275. singles: true
  276. })).concat(range(506, 562, {
  277. increment: 2,
  278. singles: true
  279. })).concat(range(570, 590, {
  280. exclude: [
  281. 572,
  282. 575,
  283. 576,
  284. 578,
  285. 583,
  286. 585,
  287. 587,
  288. 589
  289. ],
  290. singles: true
  291. }))
  292. },
  293. mixedcase_extended_b: {
  294. min: 453,
  295. max: 498,
  296. range: [
  297. [453],
  298. [456],
  299. [459],
  300. [498],
  301. ]
  302. },
  303. insensitivecase_extended_b: {
  304. min: 422,
  305. max: 451,
  306. range: [
  307. [422],
  308. [426],
  309. [443],
  310. [446, 451]
  311. ]
  312. },
  313. lowercase_ipa_extension: {
  314. min: 592,
  315. max: 683,
  316. range: [
  317. [592, 659],
  318. [665, 672],
  319. [675, 683]
  320. ]
  321. },
  322. uppercase_ipa_extension: {
  323. min: 660,
  324. max: 685,
  325. range: [
  326. [660, 664],
  327. [673, 674],
  328. [684, 685]
  329. ]
  330. },
  331. character_modifier_letters: {
  332. min: 688,
  333. max: 739,
  334. range: [
  335. [688, 696],
  336. [737, 739]
  337. ]
  338. },
  339. symbol_modifier_letters: {
  340. min: 697,
  341. max: 767,
  342. range: [
  343. [697, 736],
  344. [740, 767],
  345. ]
  346. },
  347. lowercase_greek_coptic: {
  348. min: 881,
  349. max: 1019,
  350. range: [
  351. [881],
  352. [883],
  353. [887],
  354. [912],
  355. [940, 974],
  356. [1016],
  357. [1019]
  358. ].concat(range(985, 107, {
  359. increment: 2,
  360. singles: true
  361. }))
  362. },
  363. uppercase_greek_coptic: {
  364. min: 880,
  365. max: 1018,
  366. range: [
  367. [880],
  368. [882],
  369. [886],
  370. [902],
  371. [904, 906],
  372. [908],
  373. [910, 911],
  374. [913, 929],
  375. [931, 939],
  376. [1015],
  377. [1018]
  378. ].concat(range(994, 1004, {
  379. increment: 2,
  380. singles: true
  381. }))
  382. },
  383. insensitivecase_greek_coptic: {
  384. min: 984,
  385. max: 1011,
  386. range: [
  387. [1011]
  388. ].concat(range(984, 992, {
  389. increment: 2,
  390. singles: true
  391. }))
  392. },
  393. symbol_greek_coptic: {
  394. min: 884,
  395. max: 1020,
  396. range: [
  397. [884, 885],
  398. [890, 894],
  399. [900, 901],
  400. [903],
  401. [975, 983],
  402. [988],
  403. [1008, 1014],
  404. [1020, 1023]
  405. ]
  406. },
  407. lowercase_cyrillic: {
  408. min: 1072,
  409. max: 1279,
  410. range: [
  411. [1072, 1119]
  412. ]
  413. .concat(range(1121, 1153, {
  414. increment: 2,
  415. singles: true,
  416. }))
  417. .concat(range(1163, 1215, {
  418. increment: 2,
  419. exclude: [
  420. 1189,
  421. 1205,
  422. ],
  423. singles: true,
  424. })).concat(range(1218, 1230, {
  425. increment: 2,
  426. singles: true
  427. }))
  428. .concat(range(1231, 1279, {
  429. increment: 2,
  430. exclude: [
  431. 1237
  432. ],
  433. singles: true
  434. }))
  435. },
  436. uppercase_cyrillic: {
  437. min: 1024,
  438. max: 1278,
  439. range: [
  440. [1024, 1071],
  441. ]
  442. .concat(range(1120, 1214, {
  443. increment: 2,
  444. exclude: [
  445. 1154,
  446. 1156,
  447. 1158,
  448. 1160,
  449. 1188,
  450. 1204,
  451. ],
  452. singles: true
  453. }))
  454. .concat(range(1217, 1229, {
  455. increment: 2,
  456. singles: true
  457. }))
  458. .concat(range(1232, 1278, {
  459. increment: 2,
  460. exclude: [
  461. 1236
  462. ],
  463. singles: true,
  464. }))
  465. },
  466. symbols_cyrillic: {
  467. min: 1154,
  468. max: 1237,
  469. range: [
  470. [1154],
  471. [1188, 1189],
  472. [1204, 1205],
  473. [1236, 1237]
  474. ]
  475. },
  476. lowercase_cyrillic_supplement: {
  477. min: 1281,
  478. max: 1319,
  479. range: range(1281, 1319, {
  480. increment: 2,
  481. singles: true,
  482. })
  483. },
  484. uppercase_cyrillic_supplement: {
  485. min: 1280,
  486. max: 1319,
  487. range: range(1280, 1319, {
  488. increment: 2,
  489. singles: true
  490. })
  491. },
  492. misc_cyrillic_supplement: {
  493. min: 1320,
  494. max: 1327
  495. },
  496. general_punctuation: {
  497. min: 8208,
  498. max: 8286,
  499. range: [
  500. [8208, 8231],
  501. [8240, 8286]
  502. ]
  503. },
  504. currency_symbols: {
  505. min: 8352,
  506. max: 8383,
  507. range: [
  508. [8352, 8371],
  509. [8373, 8383]
  510. ]
  511. },
  512. misc_technical: {
  513. min: 8960,
  514. max: 9215,
  515. },
  516. box_drawings: {
  517. min: 9472,
  518. max: 9599
  519. },
  520. block_elements: {
  521. min: 9600,
  522. max: 9631
  523. },
  524. misc_symbols: {
  525. min: 9728,
  526. max: 9983,
  527. range: [
  528. [9728, 9897],
  529. [9899, 9983]
  530. ]
  531. },
  532. dingbats: {
  533. min: 9984,
  534. max: 10175
  535. },
  536. };
  537. export default characterCodeConstraints;