Type Alias: CollectionOptions<T>
CollectionOptions<
T> =object
Defined in: src/types.ts:122
Options of an ActiveCollection.
Type Parameters
T
T = any
Properties
coerce?
optionalcoerce?:boolean
Defined in: src/types.ts:138
Turn plain objects into model instances (Model.createLazy). true by default; false accepts instances only.
compare?
optionalcompare?: (a,b) =>number
Defined in: src/types.ts:134
Keep the collection sorted by a custom comparator (takes precedence over sortBy).
Parameters
a
T
b
T
Returns
number
order?
optionalorder?:"asc"|"desc"
Defined in: src/types.ts:136
Sort direction, asc by default.
sortBy?
optionalsortBy?:KeyOf<T>
Defined in: src/types.ts:127
Keep the collection sorted by this key: a field name or a (item) => key function. null/undefined keys sort last.
unique?
optionalunique?:KeyOf<T>
Defined in: src/types.ts:132
No two items may share this key (a field name or a (item) => key); null/undefined keys are exempt. Checked when items come in, and it enables getByKey() / hasKey().