Skip to content

Commit

Permalink
Bump scure-base
Browse files Browse the repository at this point in the history
  • Loading branch information
paulmillr committed Nov 23, 2024
1 parent 98b3202 commit 9f007bc
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"version": "0.6.3",
"description": "Define complex binary structures using composable primitives",
"dependencies": {
"@scure/base": "~1.2.0"
"@scure/base": "~1.2.1"
},
"files": [
"!lib/_type_test.js",
Expand Down
7 changes: 4 additions & 3 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1484,9 +1484,10 @@ const createHex = (
options: HexOpts = { isLE: false, with0x: false }
): CoderType<string> => {
let inner = apply(createBytes(len, options.isLE), baseHex);
if (typeof options.with0x !== 'boolean')
throw new Error(`hex/with0x: expected boolean, got ${typeof options.with0x}`);
if (options.with0x) {
const prefix = options.with0x;
if (typeof prefix !== 'boolean')
throw new Error(`hex/with0x: expected boolean, got ${typeof prefix}`);
if (prefix) {
inner = apply(inner, {
encode: (value) => `0x${value}`,
decode: (value) => {
Expand Down

0 comments on commit 9f007bc

Please sign in to comment.