|
102 | 102 | return TargetObject |
103 | 103 | } |
104 | 104 |
|
105 | | -/**** throwableError - simplifies construction of named errors ****/ |
| 105 | +/**** throwError - simplifies construction of named errors ****/ |
106 | 106 |
|
107 | | - export function throwableError (Message:string):Error { |
| 107 | + export function throwError (Message:string):never { |
108 | 108 | let Match = /^([$a-zA-Z][$a-zA-Z0-9]*):\s*(\S.+)\s*$/.exec(Message) |
109 | 109 | if (Match == null) { |
110 | | - return new Error(Message) |
| 110 | + throw new Error(Message) |
111 | 111 | } else { |
112 | 112 | let namedError = new Error(Match[2]) |
113 | 113 | namedError.name = Match[1] |
114 | | - return namedError |
| 114 | + throw namedError |
115 | 115 | } |
116 | 116 | } |
117 | 117 |
|
118 | | -/**** throwError - throws a named error ****/ |
119 | | - |
120 | | - export function throwError (Message:string):never { |
121 | | - throw throwableError(Message) |
122 | | - } |
123 | | - |
124 | 118 | //------------------------------------------------------------------------------ |
125 | 119 | //-- Value Classification Functions -- |
126 | 120 | //------------------------------------------------------------------------------ |
|
1191 | 1185 | /**** allow/expect[ed]Color ****/ |
1192 | 1186 |
|
1193 | 1187 | export const allowColor = /*#__PURE__*/ ValidatorForClassifier( |
1194 | | - ValueIsColor, acceptNil, 'valid CSS color specification' |
| 1188 | + ValueIsColor, acceptNil, 'CSS color specification' |
1195 | 1189 | ), allowedColor = allowColor |
1196 | 1190 |
|
1197 | 1191 | export const expectColor = /*#__PURE__*/ ValidatorForClassifier( |
1198 | | - ValueIsColor, rejectNil, 'valid CSS color specification' |
| 1192 | + ValueIsColor, rejectNil, 'CSS color specification' |
1199 | 1193 | ), expectedColor = expectColor |
1200 | 1194 |
|
1201 | 1195 | /**** allow/expect[ed]EMailAddress ****/ |
1202 | 1196 |
|
1203 | 1197 | export const allowEMailAddress = /*#__PURE__*/ ValidatorForClassifier( |
1204 | | - ValueIsEMailAddress, acceptNil, 'valid EMail address' |
| 1198 | + ValueIsEMailAddress, acceptNil, 'EMail address' |
1205 | 1199 | ), allowedEMailAddress = allowEMailAddress |
1206 | 1200 |
|
1207 | 1201 | export const expectEMailAddress = /*#__PURE__*/ ValidatorForClassifier( |
1208 | | - ValueIsEMailAddress, rejectNil, 'valid EMail address' |
| 1202 | + ValueIsEMailAddress, rejectNil, 'EMail address' |
1209 | 1203 | ), expectedEMailAddress = expectEMailAddress |
1210 | 1204 |
|
1211 | 1205 | /**** allow/expect[ed]URL ****/ |
1212 | 1206 |
|
1213 | 1207 | export const allowURL = /*#__PURE__*/ ValidatorForClassifier( |
1214 | | - ValueIsURL, acceptNil, 'valid URL' |
| 1208 | + ValueIsURL, acceptNil, 'URL' |
1215 | 1209 | ), allowedURL = allowURL |
1216 | 1210 |
|
1217 | 1211 | export const expectURL = /*#__PURE__*/ ValidatorForClassifier( |
1218 | | - ValueIsURL, rejectNil, 'valid URL' |
| 1212 | + ValueIsURL, rejectNil, 'URL' |
1219 | 1213 | ), expectedURL = expectURL |
1220 | 1214 |
|
1221 | 1215 | /**** escaped - escapes all control characters in a given string ****/ |
|
0 commit comments