Repeats an array elements a specified number of times, creating a new flattened array. Access via MCP in Cursor or other AI editors, or call GET /v1/array/repeat directly. Pass [1,2,3] with n=2 to get [1,2,3,1,2,3]. Deterministic operation perfect for generating test data or pattern creation in AI workflows.
curl "https://tinyfn.io/v1/array/repeat" \
-H "X-API-Key: YOUR_API_KEY"
const response = await fetch('https://tinyfn.io/v1/array/repeat', {
headers: { 'X-API-Key': 'YOUR_API_KEY' }
});
const data = await response.json();
console.log(data);
import requests
response = requests.get('https://tinyfn.io/v1/array/repeat',
headers={'X-API-Key': 'YOUR_API_KEY'})
data = response.json()
print(data)
Connect your AI agent (Claude, Cursor, Windsurf, etc.) to TinyFn's array tools:
{
"mcpServers": {
"tinyfn-array": {
"url": "https://tinyfn.io/mcp/array",
"headers": {
"X-API-Key": "YOUR_API_KEY"
}
}
}
}
Call the array_repeat tool with your array and repetition count. In Cursor or Claude Code, it returns the flattened result immediately without concatenation guesswork.
Returns an empty array []. Negative values typically return empty arrays too, following safe default behavior.
Yes, it preserves the exact structure of each element. [[1,2], {a:3}] repeated twice becomes [[1,2], {a:3}, [1,2], {a:3}].
Array repeat duplicates entire array contents, while string repeat duplicates individual characters. Use array repeat for collections, string repeat for text patterns.
Absolutely. Perfect for creating consistent test data patterns, mock API responses, or repeating configuration blocks in AI-generated code.
Get your free API key and start using Array Repeat in seconds.
Get Free API Key