From bacaaaef8a18cbc5264b31f63f03434ac16e3204 Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Tue, 6 Jun 2017 07:06:47 -0700 Subject: [PATCH] Support symbols in property paths of `set`. [closes #3189] --- .internal/isIndex.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.internal/isIndex.js b/.internal/isIndex.js index 3d9e218a2..f53a11f53 100644 --- a/.internal/isIndex.js +++ b/.internal/isIndex.js @@ -13,10 +13,13 @@ const reIsUint = /^(?:0|[1-9]\d*)$/ * @returns {boolean} Returns `true` if `value` is a valid index, else `false`. */ function isIndex(value, length) { + const type = typeof value length = length == null ? MAX_SAFE_INTEGER : length + return !!length && - (typeof value == 'number' || reIsUint.test(value)) && - (value > -1 && value % 1 == 0 && value < length) + (type == 'number' || + (type != 'symbol' && reIsUint.test(value))) && + (value > -1 && value % 1 == 0 && value < length) } export default isIndex