@@ -36,7 +36,6 @@ import { instance as getVisitor } from './visitor/get.js';
36
36
import { instance as setVisitor } from './visitor/set.js' ;
37
37
import { instance as indexOfVisitor } from './visitor/indexof.js' ;
38
38
import { instance as iteratorVisitor } from './visitor/iterator.js' ;
39
- import { instance as byteLengthVisitor } from './visitor/bytelength.js' ;
40
39
41
40
// @ts -ignore
42
41
import type { vectorFromArray } from './factories.js' ;
@@ -56,7 +55,7 @@ export interface Vector<T extends DataType = any> {
56
55
[ Symbol . isConcatSpreadable ] : true ;
57
56
}
58
57
59
- const visitorsByTypeId = { } as { [ typeId : number ] : { get : any ; set : any ; indexOf : any ; byteLength : any } } ;
58
+ const visitorsByTypeId = { } as { [ typeId : number ] : { get : any ; set : any ; indexOf : any } } ;
60
59
const vectorPrototypesByTypeId = { } as { [ typeId : number ] : any } ;
61
60
62
61
/**
@@ -76,14 +75,13 @@ export class Vector<T extends DataType = any> {
76
75
case 0 : this . _offsets = [ 0 ] ; break ;
77
76
case 1 : {
78
77
// special case for unchunked vectors
79
- const { get, set, indexOf, byteLength } = visitorsByTypeId [ type . typeId ] ;
78
+ const { get, set, indexOf } = visitorsByTypeId [ type . typeId ] ;
80
79
const unchunkedData = data [ 0 ] ;
81
80
82
81
this . isValid = ( index : number ) => isChunkedValid ( unchunkedData , index ) ;
83
82
this . get = ( index : number ) => get ( unchunkedData , index ) ;
84
83
this . set = ( index : number , value : T ) => set ( unchunkedData , index , value ) ;
85
84
this . indexOf = ( index : number ) => indexOf ( unchunkedData , index ) ;
86
- this . getByteLength = ( index : number ) => byteLength ( unchunkedData , index ) ;
87
85
this . _offsets = [ 0 , unchunkedData . length ] ;
88
86
break ;
89
87
}
@@ -200,13 +198,6 @@ export class Vector<T extends DataType = any> {
200
198
return this . indexOf ( element , offset ) > - 1 ;
201
199
}
202
200
203
- /**
204
- * Get the size in bytes of an element by index.
205
- * @param index The index at which to get the byteLength.
206
- */
207
- // @ts -ignore
208
- public getByteLength ( index : number ) : number { return 0 ; }
209
-
210
201
/**
211
202
* Iterator for the Vector's elements.
212
203
*/
@@ -366,15 +357,13 @@ export class Vector<T extends DataType = any> {
366
357
const get = getVisitor . getVisitFnByTypeId ( typeId ) ;
367
358
const set = setVisitor . getVisitFnByTypeId ( typeId ) ;
368
359
const indexOf = indexOfVisitor . getVisitFnByTypeId ( typeId ) ;
369
- const byteLength = byteLengthVisitor . getVisitFnByTypeId ( typeId ) ;
370
360
371
- visitorsByTypeId [ typeId ] = { get, set, indexOf, byteLength } ;
361
+ visitorsByTypeId [ typeId ] = { get, set, indexOf } ;
372
362
vectorPrototypesByTypeId [ typeId ] = Object . create ( proto , {
373
363
[ 'isValid' ] : { value : wrapChunkedCall1 ( isChunkedValid ) } ,
374
364
[ 'get' ] : { value : wrapChunkedCall1 ( getVisitor . getVisitFnByTypeId ( typeId ) ) } ,
375
365
[ 'set' ] : { value : wrapChunkedCall2 ( setVisitor . getVisitFnByTypeId ( typeId ) ) } ,
376
366
[ 'indexOf' ] : { value : wrapChunkedIndexOf ( indexOfVisitor . getVisitFnByTypeId ( typeId ) ) } ,
377
- [ 'getByteLength' ] : { value : wrapChunkedCall1 ( byteLengthVisitor . getVisitFnByTypeId ( typeId ) ) } ,
378
367
} ) ;
379
368
}
380
369
0 commit comments