keysIn.js 652 Bytes
Newer Older
徐立's avatar
徐立 committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
/**
 * Creates an array of the own and inherited enumerable property names of `object`.
 * 创建一个自己的和继承的可枚举属性名'对象'的数组。
 *
 * @static
 * @memberOf _
 * @since 3.0.0
 * @category Object
 * @param {Object} object 要查询的对象。
 * @returns {Array} 返回属性名数组。
 * @example
 *
 * function Foo() {
 *   this.a = 1;
 *   this.b = 2;
 * }
 *
 * Foo.prototype.c = 3;
 *
 * _.keysIn(new Foo);
 * // => ['a', 'b', 'c'] (iteration order is not guaranteed)
 */
function keysIn(object) {
24 25 26 27 28
	const result = [];
	for (const key in object) {
		result.push(key);
	}
	return result;
徐立's avatar
徐立 committed
29 30
}

31
export default keysIn;