Collections
Namespace: Vercel.AI.Util
public static class CollectionsArray and property helpers from the AI SDK util package.
Inheritance: object
Methods
Section titled “Methods”GetOwn(IDictionary<string, object>?, string?)
Section titled “GetOwn(IDictionary<string, object>?, string?)”public static object? GetOwn(IDictionary<string, object>? obj, string? key)Returns an own dictionary entry, or null when the key is absent.
Parameters
| Name | Type | Description |
|---|---|---|
obj |
IDictionary<string, object> | |
key |
string |
Returns: object
GetOwn(DataObject?, string?)
Section titled “GetOwn(DataObject?, string?)”public static object? GetOwn(DataObject? obj, string? key)Returns an own property value. Inherited names such as constructor are not returned.
Null and undefined objects return null.
Parameters
| Name | Type | Description |
|---|---|---|
obj |
DataObject | |
key |
string |
Returns: object
GetPotentialStartIndex(string?, string?)
Section titled “GetPotentialStartIndex(string?, string?)”public static int? GetPotentialStartIndex(string? text, string? searchedText)Largest index where <code class=“paramref”>searchedText</code> occurs, or where a suffix of
<code class=“paramref”>text</code> is a prefix of <code class=“paramref”>searchedText</code>. Empty search text returns null.
Parameters
| Name | Type | Description |
|---|---|---|
text |
string | |
searchedText |
string |
Returns: int?
SplitArray<T>(IReadOnlyList<T>?, int)
Section titled “SplitArray<T>(IReadOnlyList<T>?, int)”public static List<List<T>> SplitArray<T>(IReadOnlyList<T>? array, int chunkSize)Splits <code class=“paramref”>array</code> into chunks of <code class=“paramref”>chunkSize</code>.
Type parameters
| Name | Description |
|---|---|
T |
Parameters
| Name | Type | Description |
|---|---|---|
array |
IReadOnlyList<T> | |
chunkSize |
int |
Returns: List<List<T>>
Apache-2.0 · Copyright 2023 Vercel, Inc. · unofficial community port, not an official Vercel product