|
213 | 213 | } |
214 | 214 |
|
215 | 215 | function isArray(value) { |
216 | | - return !Array.isArray ? Object.prototype.toString.call(value) === '[object Array]' : Array.isArray(value); |
217 | | - } // Adapted from: |
218 | | - // https://github.com/lodash/lodash/blob/f4ca396a796435422bd4fd41fadbd225edddf175/.internal/baseToString.js |
| 216 | + return !Array.isArray ? getTag(value) === '[object Array]' : Array.isArray(value); |
| 217 | + } // Adapted from: https://github.com/lodash/lodash/blob/master/.internal/baseToString.js |
219 | 218 |
|
220 | 219 | var INFINITY = 1 / 0; |
221 | 220 | function baseToString(value) { |
|
235 | 234 | } |
236 | 235 | function isNumber(value) { |
237 | 236 | return typeof value === 'number'; |
| 237 | + } // Adapted from: https://github.com/lodash/lodash/blob/master/isBoolean.js |
| 238 | + |
| 239 | + function isBoolean(value) { |
| 240 | + return value === true || value === false || isObjectLike(value) && getTag(value) == '[object Boolean]'; |
238 | 241 | } |
239 | 242 | function isObject(value) { |
240 | 243 | return _typeof(value) === 'object'; |
| 244 | + } // Checks if `value` is object-like. |
| 245 | + |
| 246 | + function isObjectLike(value) { |
| 247 | + return isObject(value) && value !== null; |
241 | 248 | } |
242 | 249 | function isDefined(value) { |
243 | 250 | return value !== undefined && value !== null; |
244 | 251 | } |
245 | 252 | function isBlank(value) { |
246 | 253 | return !value.trim().length; |
| 254 | + } // Gets the `toStringTag` of `value`. |
| 255 | + // Adapted from: https://github.com/lodash/lodash/blob/master/.internal/getTag.js |
| 256 | + |
| 257 | + function getTag(value) { |
| 258 | + return value == null ? value === undefined ? '[object Undefined]' : '[object Null]' : Object.prototype.toString.call(value); |
247 | 259 | } |
248 | 260 |
|
249 | 261 | var EXTENDED_SEARCH_UNAVAILABLE = 'Extended search is not available'; |
|
364 | 376 |
|
365 | 377 | if (!isDefined(value)) { |
366 | 378 | return; |
367 | | - } |
| 379 | + } // If we're at the last value in the path, and if it's a string/number/bool, |
| 380 | + // add it to the list |
| 381 | + |
368 | 382 |
|
369 | | - if (index === path.length - 1 && (isString(value) || isNumber(value))) { |
| 383 | + if (index === path.length - 1 && (isString(value) || isNumber(value) || isBoolean(value))) { |
370 | 384 | list.push(toString(value)); |
371 | 385 | } else if (isArray(value)) { |
372 | 386 | arr = true; // Search each item in the array. |
|
0 commit comments