Comparing version 0.2.1 to 0.2.2
@@ -213,2 +213,62 @@ /** | ||
} | ||
}, | ||
bhash160: { | ||
min: Buffer.alloc(20, 0x00), | ||
max: Buffer.alloc(20, 0xff), | ||
dynamic: false, | ||
size(v) { | ||
return 20; | ||
}, | ||
read(k, o) { | ||
assertLen(o + 20 <= k.length); | ||
return k.slice(o, o + 20); | ||
}, | ||
write(k, v, o) { | ||
assertType(Buffer.isBuffer(v)); | ||
assertType(v.copy(k, o) === 20); | ||
return 20; | ||
} | ||
}, | ||
bhash256: { | ||
min: Buffer.alloc(32, 0x00), | ||
max: Buffer.alloc(32, 0xff), | ||
dynamic: false, | ||
size(v) { | ||
return 32; | ||
}, | ||
read(k, o) { | ||
assertLen(o + 32 <= k.length); | ||
return k.slice(o, o + 32); | ||
}, | ||
write(k, v, o) { | ||
assertType(Buffer.isBuffer(v)); | ||
assertType(v.copy(k, o) === 32); | ||
return 32; | ||
} | ||
}, | ||
bhash: { | ||
min: Buffer.alloc(1, 0x00), | ||
max: Buffer.alloc(64, 0xff), | ||
dynamic: true, | ||
size(v) { | ||
assertType(Buffer.isBuffer(v)); | ||
return 1 + v.length; | ||
}, | ||
read(k, o) { | ||
assertLen(o + 1 <= k.length); | ||
assertLen(k[o] >= 1 && k[o] <= 64); | ||
assertLen(o + 1 + k[o] <= k.length); | ||
return k.slice(o + 1, o + 1 + k[o]); | ||
}, | ||
write(k, v, o) { | ||
assertType(Buffer.isBuffer(v)); | ||
assertType(v.length >= 1 && v.length <= 64); | ||
assertLen(o + 1 <= k.length); | ||
k[o] = v.length; | ||
assertType(v.copy(k, o + 1) === v.length); | ||
return 1 + v.length; | ||
} | ||
} | ||
@@ -422,3 +482,3 @@ }; | ||
return data.length; | ||
assert(typeof data === 'string'); | ||
assertType(typeof data === 'string'); | ||
return data.length >>> 1; | ||
@@ -430,3 +490,3 @@ } | ||
return str.copy(data, off); | ||
assert(typeof str === 'string'); | ||
assertType(typeof str === 'string'); | ||
return data.write(str, off, 'hex'); | ||
@@ -433,0 +493,0 @@ } |
{ | ||
"name": "bdb", | ||
"version": "0.2.1", | ||
"version": "0.2.2", | ||
"description": "Database for bcoin", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
92526
3756