this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

define regex once

+3 -1
+3 -1
source/to-decimal.ts
··· 2 2 return letter.codePointAt(0)! - 'A'.codePointAt(0)! + 1; 3 3 } 4 4 5 + const allowedStringPattern = /^[A-Z]+$/v; 6 + 5 7 /** 6 8 * Converts a bijective base-26 string to a decimal number. 7 9 * 8 10 * @param string 9 11 */ 10 12 export default function toDecimal(string: string): number { 11 - if (typeof string !== 'string' || !/^[A-Z]+$/v.test(string)) { 13 + if (typeof string !== 'string' || !allowedStringPattern.test(string)) { 12 14 throw new TypeError( 13 15 `Expected string to only contain upper-case letters, got \`${string}\``, 14 16 );