This repository was archived by the owner on Jan 13, 2025. It is now read-only.
File tree 4 files changed +11
-12
lines changed
4 files changed +11
-12
lines changed Original file line number Diff line number Diff line change 1
1
# Change Log
2
2
3
+ ## [ 1.2.2] - 2021-07-05
4
+
5
+ * Improve [ browser compatibility] [ pr#26 ] by eliminating a dependence on
6
+ the Node assert module.
7
+
3
8
## [ 1.2.1] - 2021-04-29
4
9
5
10
* Improve [ browser compatibility] [ pr#24 ] by using ` Buffer.isBuffer ` instead of
136
141
137
142
* Initial release.
138
143
144
+ [ 1.2.2 ] : https://github.com/pabigot/buffer-layout/compare/v1.2.1...v1.2.2
139
145
[ 1.2.1 ] : https://github.com/pabigot/buffer-layout/compare/v1.2.0...v1.2.1
140
146
[ 1.2.0 ] : https://github.com/pabigot/buffer-layout/compare/v1.1.0...v1.2.0
141
147
[ 1.1.0 ] : https://github.com/pabigot/buffer-layout/compare/v1.0.0...v1.1.0
200
206
[ issue#20 ] : https://github.com/pabigot/buffer-layout/issues/20
201
207
[ issue#21 ] : https://github.com/pabigot/buffer-layout/issues/21
202
208
[ pr#24 ] : https://github.com/pabigot/buffer-layout/pull/24
209
+ [ pr#26 ] : https://github.com/pabigot/buffer-layout/pull/26
203
210
[ ci:travis ] : https://travis-ci.org/pabigot/buffer-layout
204
211
[ ci:coveralls ] : https://coveralls.io/github/pabigot/buffer-layout
205
212
[ node:issue#3992 ] : https://github.com/nodejs/node/issues/3992
Original file line number Diff line number Diff line change 132
132
133
133
'use strict' ;
134
134
135
- const assert = require ( 'assert' ) ;
136
-
137
135
/**
138
136
* Base class for layout objects.
139
137
*
@@ -715,8 +713,6 @@ const V2E32 = Math.pow(2, 32);
715
713
function divmodInt64 ( src ) {
716
714
const hi32 = Math . floor ( src / V2E32 ) ;
717
715
const lo32 = src - ( hi32 * V2E32 ) ;
718
- // assert.equal(roundedInt64(hi32, lo32), src);
719
- // assert(0 <= lo32);
720
716
return { hi32, lo32} ;
721
717
}
722
718
/* Reconstruct Number from quotient and non-negative remainder */
@@ -1261,12 +1257,7 @@ class Structure extends Layout {
1261
1257
for ( const fd of this . fields ) {
1262
1258
let span = fd . span ;
1263
1259
lastWrote = ( 0 < span ) ? span : 0 ;
1264
- if ( undefined === fd . property ) {
1265
- /* By construction the field must be fixed-length (because
1266
- * unnamed variable-length fields are disallowed when
1267
- * encoding). But check it anyway. */
1268
- assert ( 0 < span ) ;
1269
- } else {
1260
+ if ( undefined !== fd . property ) {
1270
1261
const fv = src [ fd . property ] ;
1271
1262
if ( undefined !== fv ) {
1272
1263
lastWrote = fd . encode ( fv , b , offset ) ;
Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " buffer-layout" ,
3
- "version" : " 1.2.1 " ,
3
+ "version" : " 1.2.2 " ,
4
4
"description" : " Translation between JavaScript values and Buffers" ,
5
5
"keywords" : [
6
6
" Buffer" ,
Original file line number Diff line number Diff line change @@ -672,7 +672,8 @@ suite('Layout', function() {
672
672
assert . throws ( ( ) => new lo . Structure ( 'stuff' ) , TypeError ) ;
673
673
assert . throws ( ( ) => new lo . Structure ( [ 'stuff' ] ) , TypeError ) ;
674
674
// no unnamed variable-length fields
675
- assert . throws ( ( ) => new lo . Structure ( [ lo . cstr ( ) ] ) , Error ) ;
675
+ assert . throws ( ( ) => new lo . Structure ( [ lo . cstr ( ) ] ) ,
676
+ err => checkError ( err , Error , / c a n n o t c o n t a i n u n n a m e d v a r i a b l e - l e n g t h l a y o u t / ) ) ;
676
677
} ) ;
677
678
test ( 'basics' , function ( ) {
678
679
const st = new lo . Structure ( [ lo . u8 ( 'u8' ) ,
You can’t perform that action at this time.
0 commit comments