Creates an array of the own enumerable property names of `object`. **Note:** Non-object values are coerced to objects. See the [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys) for more details.
function Foo() {
this.a = 1
this.b = 2
}
Foo.prototype.c = 3
keys(new Foo)
// => ['a', 'b'] (iteration order is not guaranteed)
keys('hi')
// => ['0', '1']
| Name | Type | Attribute | Description |
|---|---|---|---|
| object | The object to query. |
{
"comment": "/**\r\n * Creates an array of the own enumerable property names of `object`.\r\n *\r\n * **Note:** Non-object values are coerced to objects. See the\r\n * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)\r\n * for more details.\r\n *\r\n * @since 0.1.0\r\n * @category Object\r\n * @param {Object} object The object to query.\r\n * @returns {Array} Returns the array of property names.\r\n * @see values, valuesIn\r\n * @example\r\n *\r\n * function Foo() {\r\n * this.a = 1\r\n * this.b = 2\r\n * }\r\n *\r\n * Foo.prototype.c = 3\r\n *\r\n * keys(new Foo)\r\n * // => ['a', 'b'] (iteration order is not guaranteed)\r\n *\r\n * keys('hi')\r\n * // => ['0', '1']\r\n */",
"meta": {
"range": [
797,
896
],
"filename": "keys.js",
"lineno": 32,
"path": "C:\\Users\\beaujeup\\projects\\jsdoc-template\\examples\\lodash\\lodash-repo",
"code": {
"id": "astnode100005534",
"name": "keys",
"type": "FunctionDeclaration",
"paramnames": [
"object"
]
}
},
"description": "Creates an array of the own enumerable property names of `object`.\r\r**Note:** Non-object values are coerced to objects. See the\r[ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)\rfor more details.",
"since": "0.1.0",
"tags": [
{
"originalTitle": "category",
"title": "category",
"text": "Object",
"value": "Object"
}
],
"params": [
{
"type": {
"names": [
"Object"
]
},
"description": "The object to query.",
"name": "object"
}
],
"returns": [
{
"type": {
"names": [
"Array"
]
},
"description": "Returns the array of property names."
}
],
"see": [
"values, valuesIn"
],
"examples": [
"function Foo() {\r this.a = 1\r this.b = 2\r}\r\rFoo.prototype.c = 3\r\rkeys(new Foo)\r// => ['a', 'b'] (iteration order is not guaranteed)\r\rkeys('hi')\r// => ['0', '1']"
],
"name": "keys",
"longname": "keys",
"kind": "function",
"scope": "global",
"___id": "T000002R000518",
"___s": true,
"filepath": "keys.js"
}