mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-09 10:27:49 +00:00
Remove check for existence of getOwnPropertySymbols (#4102)
This commit is contained in:
committed by
John-David Dalton
parent
8eccdd098a
commit
151e316263
@@ -13,7 +13,7 @@ const nativeGetSymbols = Object.getOwnPropertySymbols
|
|||||||
* @param {Object} object The object to query.
|
* @param {Object} object The object to query.
|
||||||
* @returns {Array} Returns the array of symbols.
|
* @returns {Array} Returns the array of symbols.
|
||||||
*/
|
*/
|
||||||
const getSymbols = !nativeGetSymbols ? () => [] : (object) => {
|
function getSymbols (object) {
|
||||||
if (object == null) {
|
if (object == null) {
|
||||||
return []
|
return []
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,5 @@
|
|||||||
import getSymbols from './getSymbols.js'
|
import getSymbols from './getSymbols.js'
|
||||||
|
|
||||||
/* Built-in method references for those with the same name as other `lodash` methods. */
|
|
||||||
const nativeGetSymbols = Object.getOwnPropertySymbols
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates an array of the own and inherited enumerable symbols of `object`.
|
* Creates an array of the own and inherited enumerable symbols of `object`.
|
||||||
*
|
*
|
||||||
@@ -10,7 +7,7 @@ const nativeGetSymbols = Object.getOwnPropertySymbols
|
|||||||
* @param {Object} object The object to query.
|
* @param {Object} object The object to query.
|
||||||
* @returns {Array} Returns the array of symbols.
|
* @returns {Array} Returns the array of symbols.
|
||||||
*/
|
*/
|
||||||
const getSymbolsIn = !nativeGetSymbols ? () => [] : (object) => {
|
function getSymbolsIn (object) {
|
||||||
const result = []
|
const result = []
|
||||||
while (object) {
|
while (object) {
|
||||||
result.push(...getSymbols(object))
|
result.push(...getSymbols(object))
|
||||||
|
|||||||
Reference in New Issue
Block a user