Skip to content

Instantly share code, notes, and snippets.

@garunski
Created April 23, 2016 08:27
Show Gist options
  • Select an option

  • Save garunski/6a1ba7580b8debf0f1d6617136f48949 to your computer and use it in GitHub Desktop.

Select an option

Save garunski/6a1ba7580b8debf0f1d6617136f48949 to your computer and use it in GitHub Desktop.
[LuisIntent("SearchLibraryForFunctionInClass")]
public async Task SearchLibraryForFunctionInClass(IDialogContext context, LuisResult result)
{
var message = "Could not find any documentation. Sorry try a different search.";
if (result.Entities.First(i => i.Type == "library").Entity == "lodash")
{
if (result.Entities.First(i => i.Type == "class").Entity == "array")
{
if (result.Entities.First(i => i.Type == "function").Entity == "chunk")
{
message = @"
# _.chunk(array, [size=1])
Creates an array of elements split into groups the length of size. If array can’t be split evenly, the final chunk will be the remaining elements.
## Since
3.0.0
## Arguments
*array* (**Array**): The array to process.
*size=1* (**number**): *optional*, The length of each chunk
## Returns
(**Array**): Returns the new array containing chunks.
## Example
`_.chunk(['a', 'b', 'c', 'd'], 2);`
`// → [['a', 'b'], ['c', 'd']]`
`_.chunk(['a', 'b', 'c', 'd'], 3);`
`// → [['a', 'b', 'c'], ['d']]`";
}
}
}
await context.PostAsync(message);
context.Wait(MessageReceived);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment