getAllKeysIn.js 582 Bytes
Newer Older
1
import getSymbolsIn from './getSymbolsIn.js';
徐立's avatar
徐立 committed
2 3 4 5 6 7 8 9 10

/**
 * Creates an array of own and inherited enumerable property names and symbols of `object`.
 * 创建一个包含自己的和继承的可枚举属性名和“对象”符号的数组。
 * @private
 * @param {Object} object 要查询的对象.
 * @returns {Array} 返回属性名和符号的数组。
 */
function getAllKeysIn(object) {
11 12 13 14 15 16 17 18
	const result = [];
	for (const key in object) {
		result.push(key);
	}
	if (!Array.isArray(object)) {
		result.push(...getSymbolsIn(object));
	}
	return result;
徐立's avatar
徐立 committed
19 20
}

21
export default getAllKeysIn;