Skip to main content

@terascope/data-mate / builder/ListBuilder / ListBuilder

Class: ListBuilder<T>

Defined in: data-mate/src/builder/ListBuilder.ts:7

Since Vectors are immutable, a Builder can be used to construct a Vector. When values are inserted they are coerced and validated.

Extends

Type Parameters

Type ParameterDefault type
Tunknown

Constructors

new ListBuilder()

new ListBuilder<T>(data, options): ListBuilder<T>

Defined in: data-mate/src/builder/ListBuilder.ts:10

Parameters

ParameterType
dataWritableData<readonly Maybe<T>[]>
optionsBuilderOptions

Returns

ListBuilder<T>

Overrides

Builder.constructor

Properties

PropertyModifierTypeDescriptionOverridesInherited fromDefined in
_valueFrompublicCoerceFN<readonly Maybe<T>[]>Convert a value to the internal in-memory storage format for the VectorBuilder._valueFrom-data-mate/src/builder/ListBuilder.ts:8
childConfig?readonlyDataTypeFieldsWhen Vector is an object type, this will be the data type fields for the object-Builder.childConfigdata-mate/src/builder/Builder.ts:59
configreadonlyReadonly<DataTypeFieldConfig>The field type configuration-Builder.configdata-mate/src/builder/Builder.ts:53
currentIndexpublicnumberThe current insertion index (used for append)-Builder.currentIndexdata-mate/src/builder/Builder.ts:74
datareadonlyWritableData<readonly Maybe<T>[]>Internal-Builder.datadata-mate/src/builder/Builder.ts:64
name?readonlystringThe name of field, if specified this will just be used for metadata-Builder.namedata-mate/src/builder/Builder.ts:69
typereadonlyVectorTypeThe type of Vector, this should only be set with the specific Vector type classes.-Builder.typedata-mate/src/builder/Builder.ts:48

Methods

append()

append(value): this

Defined in: data-mate/src/builder/Builder.ts:157

Append a value to the end

Parameters

ParameterType
valueunknown

Returns

this

Inherited from

Builder.append


mset()

mset(value, indices): this

Defined in: data-mate/src/builder/Builder.ts:146

Set a single unique value on multiple indices

Parameters

ParameterType
valueunknown
indicesIterable<number>

Returns

this

Inherited from

Builder.mset


resize()

resize(size): this

Defined in: data-mate/src/builder/Builder.ts:165

Resize the amount of records stored in in the writable data structure

Parameters

ParameterType
sizenumber

Returns

this

Inherited from

Builder.resize


set()

set(index, value): this

Defined in: data-mate/src/builder/Builder.ts:138

Set value by index

Parameters

ParameterType
indexnumber
valueunknown

Returns

this

Inherited from

Builder.set


toVector()

toVector(): Vector<readonly Maybe<T>[]>

Defined in: data-mate/src/builder/Builder.ts:175

Flush and convert the result to a Vector

Returns

Vector<readonly Maybe<T>[]>

Inherited from

Builder.toVector


valueFrom()

valueFrom(value, indices?): readonly Maybe<T>[]

Defined in: data-mate/src/builder/Builder.ts:102

Convert a value to the internal in-memory storage format for the Vector

Parameters

ParameterType
valueunknown
indices?number | Iterable<number, any, any>

Returns

readonly Maybe<T>[]

Inherited from

Builder.valueFrom


make()

static make<R>(data, options): Builder<R>

Defined in: data-mate/src/builder/Builder.ts:14

Make an instance of a Builder from a DataTypeFieldConfig

Type Parameters

Type ParameterDefault type
Runknown

Parameters

ParameterType
dataWritableData<R>
optionsBuilderOptions

Returns

Builder<R>

Inherited from

Builder.make


makeFromVector()

static makeFromVector<R>(vector, size): Builder<R>

Defined in: data-mate/src/builder/Builder.ts:28

Convert a Vector to a Builder with current values populated depending on the length populated

Type Parameters

Type Parameter
R

Parameters

ParameterType
vectorVector<R>
sizenumber

Returns

Builder<R>

Inherited from

Builder.makeFromVector