Invokes the iteratee `n` times, returning an array of the results of each invocation. The iteratee is invoked with one argumentindex).
times(3, String)
// => ['0', '1', '2']
times(4, constant(0))
// => [0, 0, 0, 0]
| Name | Type | Attribute | Description |
|---|---|---|---|
| n | The number of times to invoke `iteratee`. | ||
| iteratee | The function invoked per iteration. |
{
"comment": "/**\r\n * Invokes the iteratee `n` times, returning an array of the results of\r\n * each invocation. The iteratee is invoked with one argumentindex).\r\n *\r\n * @since 0.1.0\r\n * @category Util\r\n * @param {number} n The number of times to invoke `iteratee`.\r\n * @param {Function} iteratee The function invoked per iteration.\r\n * @returns {Array} Returns the array of results.\r\n * @example\r\n *\r\n * times(3, String)\r\n * // => ['0', '1', '2']\r\n *\r\n * times(4, constant(0))\r\n * // => [0, 0, 0, 0]\r\n */",
"meta": {
"range": [
709,
1096
],
"filename": "times.js",
"lineno": 24,
"path": "C:\\Users\\beaujeup\\projects\\jsdoc-template\\examples\\lodash\\lodash-repo",
"code": {
"id": "astnode100009620",
"name": "times",
"type": "FunctionDeclaration",
"paramnames": [
"n",
"iteratee"
]
},
"vars": {
"index": "times~index",
"length": "times~length",
"result": "times~result",
"result[undefined]": "times~result[undefined]",
"n": "times~n"
}
},
"description": "Invokes the iteratee `n` times, returning an array of the results of\reach invocation. The iteratee is invoked with one argumentindex).",
"since": "0.1.0",
"tags": [
{
"originalTitle": "category",
"title": "category",
"text": "Util",
"value": "Util"
}
],
"params": [
{
"type": {
"names": [
"number"
]
},
"description": "The number of times to invoke `iteratee`.",
"name": "n"
},
{
"type": {
"names": [
"function"
]
},
"description": "The function invoked per iteration.",
"name": "iteratee"
}
],
"returns": [
{
"type": {
"names": [
"Array"
]
},
"description": "Returns the array of results."
}
],
"examples": [
"times(3, String)\r// => ['0', '1', '2']\r\r times(4, constant(0))\r// => [0, 0, 0, 0]"
],
"name": "times",
"longname": "times",
"kind": "function",
"scope": "global",
"___id": "T000002R000886",
"___s": true,
"filepath": "times.js"
}