getSymbols.js 785 Bytes
Newer Older
徐立's avatar
徐立 committed
1 2
/** Built-in value references. */
/** 内置参考价值。 */
3
const propertyIsEnumerable = Object.prototype.propertyIsEnumerable;
徐立's avatar
徐立 committed
4 5 6

/* Built-in method references for those with the same name as other `lodash` methods. */
/* 内置的方法引用与其他“lodash”方法同名。 */
7
const nativeGetSymbols = Object.getOwnPropertySymbols;
徐立's avatar
徐立 committed
8 9 10 11 12 13 14 15 16

/**
 * Creates an array of the own enumerable symbols of `object`.
 * 创建“对象”的可枚举符号的数组。
 * @private
 * @param {Object} object 要查询的对象。
 * @returns {Array} 返回符号数组.
 */
function getSymbols(object) {
17 18 19 20 21
	if (object == null) {
		return [];
	}
	object = Object(object);
	return nativeGetSymbols(object).filter((symbol) => propertyIsEnumerable.call(object, symbol));
徐立's avatar
徐立 committed
22 23
}

24
export default getSymbols;