Skip to content

Commit

Permalink
removing strictMode
Browse files Browse the repository at this point in the history
I thought it served a different purpose than it did in ./Base64.mjs
  • Loading branch information
wjaaaaaaat authored Feb 17, 2025
1 parent ec899ef commit d0d1f74
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/core/lib/Hex.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ export function toHexFast(data) {
* // returns [10,20,30]
* fromHex("0a:14:1e", "Colon");
*/
export function fromHex(data, delim="Auto", byteLen=2, removeNonAlphChars=false, strictMode=false) {
export function fromHex(data, delim="Auto", byteLen=2, removeNonAlphChars=false) {
if (byteLen < 1 || Math.round(byteLen) !== byteLen)
throw new OperationError("Byte length must be a positive integer");

Expand All @@ -116,7 +116,7 @@ export function fromHex(data, delim="Auto", byteLen=2, removeNonAlphChars=false,

const output = [];
for (let i = 0; i < data.length; i++) {
if (/[^a-f\d\s]/.test(data[i]) && strictMode)
if (/[^a-f\d\s]/.test(data[i]))
throw new OperationError("Hex input must only contain hex digits");
for (let j = 0; j < data[i].length; j += byteLen) {
output.push(parseInt(data[i].substr(j, byteLen), 16));
Expand Down

0 comments on commit d0d1f74

Please sign in to comment.