@esri/solutions-components 0.2.6 → 0.2.7
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/cjs/deduct-calculator.cjs.entry.js +1 -1
- package/dist/cjs/pci-calculator.cjs.entry.js +1 -1
- package/dist/cjs/{pciUtils-6a806ba4.js → pciUtils-423cfc68.js} +25 -7
- package/dist/collection/demos/deduct-calculator.html +2 -5
- package/dist/collection/demos/new-public-notification.html +6 -4
- package/dist/collection/utils/pciUtils.js +25 -7
- package/dist/collection/utils/pciUtils.ts +30 -7
- package/dist/components/ExpandToggle.js +110 -0
- package/dist/components/Heading.js +22 -0
- package/dist/components/_commonjsHelpers.js +22 -0
- package/dist/components/action-bar.js +276 -0
- package/dist/components/action-group.js +149 -0
- package/dist/components/action-menu.js +356 -0
- package/dist/components/action.js +214 -0
- package/dist/components/add-record-modal.d.ts +11 -0
- package/dist/components/add-record-modal.js +171 -0
- package/dist/components/array.js +15 -0
- package/dist/components/block.js +272 -0
- package/dist/components/buffer-tools.d.ts +11 -0
- package/dist/components/buffer-tools.js +11 -0
- package/dist/components/buffer-tools2.js +262 -0
- package/dist/components/button.js +263 -0
- package/dist/components/calcite-accordion-item.js +244 -0
- package/dist/components/calcite-accordion.js +180 -0
- package/dist/components/calcite-action-bar.js +11 -0
- package/dist/components/calcite-action-group.js +11 -0
- package/dist/components/calcite-action-menu.js +11 -0
- package/dist/components/calcite-action-pad.js +197 -0
- package/dist/components/calcite-action.js +11 -0
- package/dist/components/calcite-alert.js +297 -0
- package/dist/components/calcite-avatar.js +182 -0
- package/dist/components/calcite-block-section.js +155 -0
- package/dist/components/calcite-block.js +11 -0
- package/dist/components/calcite-button.js +11 -0
- package/dist/components/calcite-card.js +187 -0
- package/dist/components/calcite-checkbox.js +11 -0
- package/dist/components/calcite-chip.js +11 -0
- package/dist/components/calcite-color-picker-hex-input.js +11 -0
- package/dist/components/calcite-color-picker-swatch.js +11 -0
- package/dist/components/calcite-color-picker.js +1036 -0
- package/dist/components/calcite-combobox-item-group.js +75 -0
- package/dist/components/calcite-combobox-item.js +11 -0
- package/dist/components/calcite-combobox.js +11 -0
- package/dist/components/calcite-date-picker-day.js +11 -0
- package/dist/components/calcite-date-picker-month-header.js +11 -0
- package/dist/components/calcite-date-picker-month.js +11 -0
- package/dist/components/calcite-date-picker.js +11 -0
- package/dist/components/calcite-dropdown-group.js +11 -0
- package/dist/components/calcite-dropdown-item.js +11 -0
- package/dist/components/calcite-dropdown.js +11 -0
- package/dist/components/calcite-fab.js +144 -0
- package/dist/components/calcite-filter.js +195 -0
- package/dist/components/calcite-flow-item.js +243 -0
- package/dist/components/calcite-flow.js +147 -0
- package/dist/components/calcite-graph.js +11 -0
- package/dist/components/calcite-handle.js +11 -0
- package/dist/components/calcite-icon.js +11 -0
- package/dist/components/calcite-inline-editable.js +294 -0
- package/dist/components/calcite-input-date-picker.js +713 -0
- package/dist/components/calcite-input-message.js +11 -0
- package/dist/components/calcite-input-number.js +637 -0
- package/dist/components/calcite-input-text.js +400 -0
- package/dist/components/calcite-input-time-picker.js +434 -0
- package/dist/components/calcite-input.js +11 -0
- package/dist/components/calcite-label.js +11 -0
- package/dist/components/calcite-link.js +11 -0
- package/dist/components/calcite-list-item-group.js +65 -0
- package/dist/components/calcite-list-item.js +11 -0
- package/dist/components/calcite-list.js +11 -0
- package/dist/components/calcite-loader.js +11 -0
- package/dist/components/calcite-modal.js +11 -0
- package/dist/components/calcite-notice.js +11 -0
- package/dist/components/calcite-option-group.js +64 -0
- package/dist/components/calcite-option.js +11 -0
- package/dist/components/calcite-pagination.js +258 -0
- package/dist/components/calcite-panel.js +11 -0
- package/dist/components/calcite-pick-list-group.js +74 -0
- package/dist/components/calcite-pick-list-item.js +11 -0
- package/dist/components/calcite-pick-list.js +11 -0
- package/dist/components/calcite-popover-manager.js +94 -0
- package/dist/components/calcite-popover.js +11 -0
- package/dist/components/calcite-progress.js +11 -0
- package/dist/components/calcite-radio-button-group.js +132 -0
- package/dist/components/calcite-radio-button.js +310 -0
- package/dist/components/calcite-radio-group-item.js +11 -0
- package/dist/components/calcite-radio-group.js +11 -0
- package/dist/components/calcite-rating.js +201 -0
- package/dist/components/calcite-scrim.js +11 -0
- package/dist/components/calcite-select.js +11 -0
- package/dist/components/calcite-shell-center-row.js +100 -0
- package/dist/components/calcite-shell-panel.js +11 -0
- package/dist/components/calcite-shell.js +11 -0
- package/dist/components/calcite-slider.js +11 -0
- package/dist/components/calcite-sortable-list.js +202 -0
- package/dist/components/calcite-split-button.js +11 -0
- package/dist/components/calcite-stepper-item.js +271 -0
- package/dist/components/calcite-stepper.js +256 -0
- package/dist/components/calcite-switch.js +11 -0
- package/dist/components/calcite-tab-nav.js +11 -0
- package/dist/components/calcite-tab-title.js +11 -0
- package/dist/components/calcite-tab.js +11 -0
- package/dist/components/calcite-tabs.js +11 -0
- package/dist/components/calcite-tile-select-group.js +65 -0
- package/dist/components/calcite-tile-select.js +266 -0
- package/dist/components/calcite-tile.js +11 -0
- package/dist/components/calcite-time-picker.js +11 -0
- package/dist/components/calcite-tip-group.js +41 -0
- package/dist/components/calcite-tip-manager.js +223 -0
- package/dist/components/calcite-tip.js +162 -0
- package/dist/components/calcite-tooltip-manager.js +57 -0
- package/dist/components/calcite-tooltip.js +11 -0
- package/dist/components/calcite-tree-item.js +11 -0
- package/dist/components/calcite-tree.js +11 -0
- package/dist/components/calcite-value-list-item.js +11 -0
- package/dist/components/calcite-value-list.js +11 -0
- package/dist/components/card-manager.d.ts +11 -0
- package/dist/components/card-manager.js +143 -0
- package/dist/components/check-list.d.ts +11 -0
- package/dist/components/check-list.js +11 -0
- package/dist/components/check-list2.js +131 -0
- package/dist/components/checkbox.js +165 -0
- package/dist/components/chip.js +170 -0
- package/dist/components/color-picker-hex-input.js +363 -0
- package/dist/components/color-picker-swatch.js +2034 -0
- package/dist/components/combobox-item.js +182 -0
- package/dist/components/combobox.js +912 -0
- package/dist/components/comment-card.d.ts +11 -0
- package/dist/components/comment-card.js +90 -0
- package/dist/components/conditionalSlot.js +50 -0
- package/dist/components/config-buffer-tools.d.ts +11 -0
- package/dist/components/config-buffer-tools.js +187 -0
- package/dist/components/config-draw-tools.d.ts +11 -0
- package/dist/components/config-draw-tools.js +121 -0
- package/dist/components/config-layer-picker.d.ts +11 -0
- package/dist/components/config-layer-picker.js +163 -0
- package/dist/components/config-pdf-download.d.ts +11 -0
- package/dist/components/config-pdf-download.js +154 -0
- package/dist/components/crowdsource-manager.d.ts +11 -0
- package/dist/components/crowdsource-manager.js +90 -0
- package/dist/components/crowdsource-reporter.d.ts +11 -0
- package/dist/components/crowdsource-reporter.js +90 -0
- package/dist/components/csvUtils.js +74 -0
- package/dist/components/date-picker-day.js +111 -0
- package/dist/components/date-picker-month-header.js +224 -0
- package/dist/components/date-picker-month.js +344 -0
- package/dist/components/date-picker.js +575 -0
- package/dist/components/date.js +180 -0
- package/dist/components/debounce.js +487 -0
- package/dist/components/deduct-calculator.d.ts +11 -0
- package/dist/components/deduct-calculator.js +11 -0
- package/dist/components/deduct-calculator2.js +1002 -0
- package/dist/components/dom.js +231 -0
- package/dist/components/dropdown-group.js +96 -0
- package/dist/components/dropdown-item.js +232 -0
- package/dist/components/dropdown.js +505 -0
- package/dist/components/edit-record-modal.d.ts +11 -0
- package/dist/components/edit-record-modal.js +11 -0
- package/dist/components/edit-record-modal2.js +161 -0
- package/dist/components/filter.js +763 -0
- package/dist/components/floating-ui.js +1768 -0
- package/dist/components/form.js +228 -0
- package/dist/components/graph.js +254 -0
- package/dist/components/guid.js +24 -0
- package/dist/components/handle.js +119 -0
- package/dist/components/icon.js +202 -0
- package/dist/components/index.d.ts +61 -0
- package/dist/components/index.js +196 -0
- package/dist/components/index2.js +199 -0
- package/dist/components/info-card.d.ts +11 -0
- package/dist/components/info-card.js +11 -0
- package/dist/components/info-card2.js +97 -0
- package/dist/components/input-message.js +101 -0
- package/dist/components/input.js +740 -0
- package/dist/components/interactive.js +51 -0
- package/dist/components/interfaces.js +19 -0
- package/dist/components/interfaces2.js +21 -0
- package/dist/components/interfaces3.js +80 -0
- package/dist/components/json-editor.d.ts +11 -0
- package/dist/components/json-editor.js +11 -0
- package/dist/components/json-editor2.js +441 -0
- package/dist/components/key.js +16 -0
- package/dist/components/label.js +106 -0
- package/dist/components/label2.js +131 -0
- package/dist/components/labelFormats.js +210 -0
- package/dist/components/layer-table.d.ts +11 -0
- package/dist/components/layer-table.js +453 -0
- package/dist/components/link.js +123 -0
- package/dist/components/list-item.d.ts +11 -0
- package/dist/components/list-item.js +90 -0
- package/dist/components/list-item2.js +149 -0
- package/dist/components/list.js +83 -0
- package/dist/components/loadModules.js +28 -0
- package/dist/components/loader.js +116 -0
- package/dist/components/locale.js +412 -0
- package/dist/components/locale2.js +413 -0
- package/dist/components/map-card.d.ts +11 -0
- package/dist/components/map-card.js +354 -0
- package/dist/components/map-draw-tools.d.ts +11 -0
- package/dist/components/map-draw-tools.js +11 -0
- package/dist/components/map-draw-tools2.js +228 -0
- package/dist/components/map-layer-picker.d.ts +11 -0
- package/dist/components/map-layer-picker.js +11 -0
- package/dist/components/map-layer-picker2.js +188 -0
- package/dist/components/map-search.d.ts +11 -0
- package/dist/components/map-search.js +155 -0
- package/dist/components/map-select-tools.d.ts +11 -0
- package/dist/components/map-select-tools.js +11 -0
- package/dist/components/map-select-tools2.js +588 -0
- package/dist/components/mapViewUtils.js +129 -0
- package/dist/components/math.js +24 -0
- package/dist/components/media-card.d.ts +11 -0
- package/dist/components/media-card.js +11 -0
- package/dist/components/media-card2.js +177 -0
- package/dist/components/modal.js +495 -0
- package/dist/components/nonChromiumPlatformUtils.js +503 -0
- package/dist/components/notice.js +192 -0
- package/dist/components/observers.js +56 -0
- package/dist/components/openCloseComponent.js +56 -0
- package/dist/components/option.js +109 -0
- package/dist/components/panel.js +459 -0
- package/dist/components/pci-calculator.d.ts +11 -0
- package/dist/components/pci-calculator.js +193 -0
- package/dist/components/pdf-download.d.ts +11 -0
- package/dist/components/pdf-download.js +11 -0
- package/dist/components/pdf-download2.js +189 -0
- package/dist/components/pick-list-item.js +255 -0
- package/dist/components/pick-list.js +170 -0
- package/dist/components/popover.js +500 -0
- package/dist/components/progress.js +60 -0
- package/dist/components/public-notification.d.ts +11 -0
- package/dist/components/public-notification.js +825 -0
- package/dist/components/publicNotificationStore.js +38 -0
- package/dist/components/queryUtils.js +187 -0
- package/dist/components/radio-group-item.js +101 -0
- package/dist/components/radio-group.js +235 -0
- package/dist/components/refine-selection-tools.d.ts +11 -0
- package/dist/components/refine-selection-tools.js +11 -0
- package/dist/components/refine-selection-tools2.js +492 -0
- package/dist/components/refine-selection.d.ts +11 -0
- package/dist/components/refine-selection.js +11 -0
- package/dist/components/refine-selection2.js +376 -0
- package/dist/components/resources.js +24 -0
- package/dist/components/resources2.js +21 -0
- package/dist/components/resources3.js +38 -0
- package/dist/components/scrim.js +83 -0
- package/dist/components/select.js +259 -0
- package/dist/components/shared-list-render.js +319 -0
- package/dist/components/shell-panel.js +281 -0
- package/dist/components/shell.js +121 -0
- package/dist/components/slider.js +896 -0
- package/dist/components/solution-configuration.d.ts +11 -0
- package/dist/components/solution-configuration.js +2233 -0
- package/dist/components/solution-contents.d.ts +11 -0
- package/dist/components/solution-contents.js +11 -0
- package/dist/components/solution-contents2.js +128 -0
- package/dist/components/solution-item-details.d.ts +11 -0
- package/dist/components/solution-item-details.js +11 -0
- package/dist/components/solution-item-details2.js +234 -0
- package/dist/components/solution-item-icon.d.ts +11 -0
- package/dist/components/solution-item-icon.js +11 -0
- package/dist/components/solution-item-icon2.js +342 -0
- package/dist/components/solution-item-sharing.d.ts +11 -0
- package/dist/components/solution-item-sharing.js +11 -0
- package/dist/components/solution-item-sharing2.js +167 -0
- package/dist/components/solution-item.d.ts +11 -0
- package/dist/components/solution-item.js +11 -0
- package/dist/components/solution-item2.js +315 -0
- package/dist/components/solution-organization-variables.d.ts +11 -0
- package/dist/components/solution-organization-variables.js +11 -0
- package/dist/components/solution-organization-variables2.js +132 -0
- package/dist/components/solution-resource-item.d.ts +11 -0
- package/dist/components/solution-resource-item.js +11 -0
- package/dist/components/solution-resource-item2.js +356 -0
- package/dist/components/solution-spatial-ref.d.ts +11 -0
- package/dist/components/solution-spatial-ref.js +11 -0
- package/dist/components/solution-spatial-ref2.js +21446 -0
- package/dist/components/solution-store.js +4092 -0
- package/dist/components/solution-template-data.d.ts +11 -0
- package/dist/components/solution-template-data.js +11 -0
- package/dist/components/solution-template-data2.js +233 -0
- package/dist/components/solution-variables.d.ts +11 -0
- package/dist/components/solution-variables.js +11 -0
- package/dist/components/solution-variables2.js +150 -0
- package/dist/components/sortable.esm.js +3026 -0
- package/dist/components/split-button.js +165 -0
- package/dist/components/store-manager.d.ts +11 -0
- package/dist/components/store-manager.js +83 -0
- package/dist/components/switch.js +139 -0
- package/dist/components/tab-nav.js +241 -0
- package/dist/components/tab-title.js +276 -0
- package/dist/components/tab.js +154 -0
- package/dist/components/tabs.js +188 -0
- package/dist/components/tile.js +129 -0
- package/dist/components/time-picker.js +943 -0
- package/dist/components/tooltip.js +399 -0
- package/dist/components/tree-item.js +294 -0
- package/dist/components/tree.js +327 -0
- package/dist/components/utils.js +119 -0
- package/dist/components/utils2.js +51 -0
- package/dist/components/value-list-item.js +204 -0
- package/dist/components/value-list.js +333 -0
- package/dist/esm/deduct-calculator.entry.js +1 -1
- package/dist/esm/pci-calculator.entry.js +1 -1
- package/dist/esm/{pciUtils-e3007a1c.js → pciUtils-ecda46e5.js} +25 -7
- package/dist/solutions-components/demos/deduct-calculator.html +2 -5
- package/dist/solutions-components/demos/new-public-notification.html +6 -4
- package/dist/solutions-components/{p-ff80ffbb.entry.js → p-0512635b.entry.js} +1 -1
- package/dist/solutions-components/{p-5ec407c2.entry.js → p-0c088725.entry.js} +1 -1
- package/dist/solutions-components/p-cc815aca.js +21 -0
- package/dist/solutions-components/solutions-components.esm.js +1 -1
- package/dist/solutions-components/utils/pciUtils.ts +30 -7
- package/dist/types/utils/pciUtils.d.ts +2 -1
- package/package.json +4 -3
- package/dist/solutions-components/p-647bbd18.js +0 -21
@@ -0,0 +1,763 @@
|
|
1
|
+
/*!
|
2
|
+
* Copyright 2022 Esri
|
3
|
+
* Licensed under the Apache License, Version 2.0
|
4
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
5
|
+
*/
|
6
|
+
import { a as isSymbol, S as Symbol, i as isObject, b as baseGetTag, c as isObjectLike, r as root, f as freeGlobal } from './debounce.js';
|
7
|
+
|
8
|
+
/**
|
9
|
+
* A specialized version of `_.map` for arrays without support for iteratee
|
10
|
+
* shorthands.
|
11
|
+
*
|
12
|
+
* @private
|
13
|
+
* @param {Array} [array] The array to iterate over.
|
14
|
+
* @param {Function} iteratee The function invoked per iteration.
|
15
|
+
* @returns {Array} Returns the new mapped array.
|
16
|
+
*/
|
17
|
+
function arrayMap(array, iteratee) {
|
18
|
+
var index = -1,
|
19
|
+
length = array == null ? 0 : array.length,
|
20
|
+
result = Array(length);
|
21
|
+
|
22
|
+
while (++index < length) {
|
23
|
+
result[index] = iteratee(array[index], index, array);
|
24
|
+
}
|
25
|
+
return result;
|
26
|
+
}
|
27
|
+
|
28
|
+
/**
|
29
|
+
* Checks if `value` is classified as an `Array` object.
|
30
|
+
*
|
31
|
+
* @static
|
32
|
+
* @memberOf _
|
33
|
+
* @since 0.1.0
|
34
|
+
* @category Lang
|
35
|
+
* @param {*} value The value to check.
|
36
|
+
* @returns {boolean} Returns `true` if `value` is an array, else `false`.
|
37
|
+
* @example
|
38
|
+
*
|
39
|
+
* _.isArray([1, 2, 3]);
|
40
|
+
* // => true
|
41
|
+
*
|
42
|
+
* _.isArray(document.body.children);
|
43
|
+
* // => false
|
44
|
+
*
|
45
|
+
* _.isArray('abc');
|
46
|
+
* // => false
|
47
|
+
*
|
48
|
+
* _.isArray(_.noop);
|
49
|
+
* // => false
|
50
|
+
*/
|
51
|
+
var isArray = Array.isArray;
|
52
|
+
|
53
|
+
/** Used as references for various `Number` constants. */
|
54
|
+
var INFINITY = 1 / 0;
|
55
|
+
|
56
|
+
/** Used to convert symbols to primitives and strings. */
|
57
|
+
var symbolProto = Symbol ? Symbol.prototype : undefined,
|
58
|
+
symbolToString = symbolProto ? symbolProto.toString : undefined;
|
59
|
+
|
60
|
+
/**
|
61
|
+
* The base implementation of `_.toString` which doesn't convert nullish
|
62
|
+
* values to empty strings.
|
63
|
+
*
|
64
|
+
* @private
|
65
|
+
* @param {*} value The value to process.
|
66
|
+
* @returns {string} Returns the string.
|
67
|
+
*/
|
68
|
+
function baseToString(value) {
|
69
|
+
// Exit early for strings to avoid a performance hit in some environments.
|
70
|
+
if (typeof value == 'string') {
|
71
|
+
return value;
|
72
|
+
}
|
73
|
+
if (isArray(value)) {
|
74
|
+
// Recursively convert values (susceptible to call stack limits).
|
75
|
+
return arrayMap(value, baseToString) + '';
|
76
|
+
}
|
77
|
+
if (isSymbol(value)) {
|
78
|
+
return symbolToString ? symbolToString.call(value) : '';
|
79
|
+
}
|
80
|
+
var result = (value + '');
|
81
|
+
return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
|
82
|
+
}
|
83
|
+
|
84
|
+
/**
|
85
|
+
* This method returns the first argument it receives.
|
86
|
+
*
|
87
|
+
* @static
|
88
|
+
* @since 0.1.0
|
89
|
+
* @memberOf _
|
90
|
+
* @category Util
|
91
|
+
* @param {*} value Any value.
|
92
|
+
* @returns {*} Returns `value`.
|
93
|
+
* @example
|
94
|
+
*
|
95
|
+
* var object = { 'a': 1 };
|
96
|
+
*
|
97
|
+
* console.log(_.identity(object) === object);
|
98
|
+
* // => true
|
99
|
+
*/
|
100
|
+
function identity(value) {
|
101
|
+
return value;
|
102
|
+
}
|
103
|
+
|
104
|
+
/** `Object#toString` result references. */
|
105
|
+
var asyncTag = '[object AsyncFunction]',
|
106
|
+
funcTag$1 = '[object Function]',
|
107
|
+
genTag = '[object GeneratorFunction]',
|
108
|
+
proxyTag = '[object Proxy]';
|
109
|
+
|
110
|
+
/**
|
111
|
+
* Checks if `value` is classified as a `Function` object.
|
112
|
+
*
|
113
|
+
* @static
|
114
|
+
* @memberOf _
|
115
|
+
* @since 0.1.0
|
116
|
+
* @category Lang
|
117
|
+
* @param {*} value The value to check.
|
118
|
+
* @returns {boolean} Returns `true` if `value` is a function, else `false`.
|
119
|
+
* @example
|
120
|
+
*
|
121
|
+
* _.isFunction(_);
|
122
|
+
* // => true
|
123
|
+
*
|
124
|
+
* _.isFunction(/abc/);
|
125
|
+
* // => false
|
126
|
+
*/
|
127
|
+
function isFunction(value) {
|
128
|
+
if (!isObject(value)) {
|
129
|
+
return false;
|
130
|
+
}
|
131
|
+
// The use of `Object#toString` avoids issues with the `typeof` operator
|
132
|
+
// in Safari 9 which returns 'object' for typed arrays and other constructors.
|
133
|
+
var tag = baseGetTag(value);
|
134
|
+
return tag == funcTag$1 || tag == genTag || tag == asyncTag || tag == proxyTag;
|
135
|
+
}
|
136
|
+
|
137
|
+
/** Used as references for various `Number` constants. */
|
138
|
+
var MAX_SAFE_INTEGER$1 = 9007199254740991;
|
139
|
+
|
140
|
+
/** Used to detect unsigned integer values. */
|
141
|
+
var reIsUint = /^(?:0|[1-9]\d*)$/;
|
142
|
+
|
143
|
+
/**
|
144
|
+
* Checks if `value` is a valid array-like index.
|
145
|
+
*
|
146
|
+
* @private
|
147
|
+
* @param {*} value The value to check.
|
148
|
+
* @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
|
149
|
+
* @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
|
150
|
+
*/
|
151
|
+
function isIndex(value, length) {
|
152
|
+
var type = typeof value;
|
153
|
+
length = length == null ? MAX_SAFE_INTEGER$1 : length;
|
154
|
+
|
155
|
+
return !!length &&
|
156
|
+
(type == 'number' ||
|
157
|
+
(type != 'symbol' && reIsUint.test(value))) &&
|
158
|
+
(value > -1 && value % 1 == 0 && value < length);
|
159
|
+
}
|
160
|
+
|
161
|
+
/** Used as references for various `Number` constants. */
|
162
|
+
var MAX_SAFE_INTEGER = 9007199254740991;
|
163
|
+
|
164
|
+
/**
|
165
|
+
* Checks if `value` is a valid array-like length.
|
166
|
+
*
|
167
|
+
* **Note:** This method is loosely based on
|
168
|
+
* [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
|
169
|
+
*
|
170
|
+
* @static
|
171
|
+
* @memberOf _
|
172
|
+
* @since 4.0.0
|
173
|
+
* @category Lang
|
174
|
+
* @param {*} value The value to check.
|
175
|
+
* @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
|
176
|
+
* @example
|
177
|
+
*
|
178
|
+
* _.isLength(3);
|
179
|
+
* // => true
|
180
|
+
*
|
181
|
+
* _.isLength(Number.MIN_VALUE);
|
182
|
+
* // => false
|
183
|
+
*
|
184
|
+
* _.isLength(Infinity);
|
185
|
+
* // => false
|
186
|
+
*
|
187
|
+
* _.isLength('3');
|
188
|
+
* // => false
|
189
|
+
*/
|
190
|
+
function isLength(value) {
|
191
|
+
return typeof value == 'number' &&
|
192
|
+
value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
|
193
|
+
}
|
194
|
+
|
195
|
+
/**
|
196
|
+
* Checks if `value` is array-like. A value is considered array-like if it's
|
197
|
+
* not a function and has a `value.length` that's an integer greater than or
|
198
|
+
* equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
|
199
|
+
*
|
200
|
+
* @static
|
201
|
+
* @memberOf _
|
202
|
+
* @since 4.0.0
|
203
|
+
* @category Lang
|
204
|
+
* @param {*} value The value to check.
|
205
|
+
* @returns {boolean} Returns `true` if `value` is array-like, else `false`.
|
206
|
+
* @example
|
207
|
+
*
|
208
|
+
* _.isArrayLike([1, 2, 3]);
|
209
|
+
* // => true
|
210
|
+
*
|
211
|
+
* _.isArrayLike(document.body.children);
|
212
|
+
* // => true
|
213
|
+
*
|
214
|
+
* _.isArrayLike('abc');
|
215
|
+
* // => true
|
216
|
+
*
|
217
|
+
* _.isArrayLike(_.noop);
|
218
|
+
* // => false
|
219
|
+
*/
|
220
|
+
function isArrayLike(value) {
|
221
|
+
return value != null && isLength(value.length) && !isFunction(value);
|
222
|
+
}
|
223
|
+
|
224
|
+
/** Used for built-in method references. */
|
225
|
+
var objectProto$3 = Object.prototype;
|
226
|
+
|
227
|
+
/**
|
228
|
+
* Checks if `value` is likely a prototype object.
|
229
|
+
*
|
230
|
+
* @private
|
231
|
+
* @param {*} value The value to check.
|
232
|
+
* @returns {boolean} Returns `true` if `value` is a prototype, else `false`.
|
233
|
+
*/
|
234
|
+
function isPrototype(value) {
|
235
|
+
var Ctor = value && value.constructor,
|
236
|
+
proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto$3;
|
237
|
+
|
238
|
+
return value === proto;
|
239
|
+
}
|
240
|
+
|
241
|
+
/**
|
242
|
+
* The base implementation of `_.times` without support for iteratee shorthands
|
243
|
+
* or max array length checks.
|
244
|
+
*
|
245
|
+
* @private
|
246
|
+
* @param {number} n The number of times to invoke `iteratee`.
|
247
|
+
* @param {Function} iteratee The function invoked per iteration.
|
248
|
+
* @returns {Array} Returns the array of results.
|
249
|
+
*/
|
250
|
+
function baseTimes(n, iteratee) {
|
251
|
+
var index = -1,
|
252
|
+
result = Array(n);
|
253
|
+
|
254
|
+
while (++index < n) {
|
255
|
+
result[index] = iteratee(index);
|
256
|
+
}
|
257
|
+
return result;
|
258
|
+
}
|
259
|
+
|
260
|
+
/** `Object#toString` result references. */
|
261
|
+
var argsTag$1 = '[object Arguments]';
|
262
|
+
|
263
|
+
/**
|
264
|
+
* The base implementation of `_.isArguments`.
|
265
|
+
*
|
266
|
+
* @private
|
267
|
+
* @param {*} value The value to check.
|
268
|
+
* @returns {boolean} Returns `true` if `value` is an `arguments` object,
|
269
|
+
*/
|
270
|
+
function baseIsArguments(value) {
|
271
|
+
return isObjectLike(value) && baseGetTag(value) == argsTag$1;
|
272
|
+
}
|
273
|
+
|
274
|
+
/** Used for built-in method references. */
|
275
|
+
var objectProto$2 = Object.prototype;
|
276
|
+
|
277
|
+
/** Used to check objects for own properties. */
|
278
|
+
var hasOwnProperty$2 = objectProto$2.hasOwnProperty;
|
279
|
+
|
280
|
+
/** Built-in value references. */
|
281
|
+
var propertyIsEnumerable = objectProto$2.propertyIsEnumerable;
|
282
|
+
|
283
|
+
/**
|
284
|
+
* Checks if `value` is likely an `arguments` object.
|
285
|
+
*
|
286
|
+
* @static
|
287
|
+
* @memberOf _
|
288
|
+
* @since 0.1.0
|
289
|
+
* @category Lang
|
290
|
+
* @param {*} value The value to check.
|
291
|
+
* @returns {boolean} Returns `true` if `value` is an `arguments` object,
|
292
|
+
* else `false`.
|
293
|
+
* @example
|
294
|
+
*
|
295
|
+
* _.isArguments(function() { return arguments; }());
|
296
|
+
* // => true
|
297
|
+
*
|
298
|
+
* _.isArguments([1, 2, 3]);
|
299
|
+
* // => false
|
300
|
+
*/
|
301
|
+
var isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) {
|
302
|
+
return isObjectLike(value) && hasOwnProperty$2.call(value, 'callee') &&
|
303
|
+
!propertyIsEnumerable.call(value, 'callee');
|
304
|
+
};
|
305
|
+
|
306
|
+
/**
|
307
|
+
* This method returns `false`.
|
308
|
+
*
|
309
|
+
* @static
|
310
|
+
* @memberOf _
|
311
|
+
* @since 4.13.0
|
312
|
+
* @category Util
|
313
|
+
* @returns {boolean} Returns `false`.
|
314
|
+
* @example
|
315
|
+
*
|
316
|
+
* _.times(2, _.stubFalse);
|
317
|
+
* // => [false, false]
|
318
|
+
*/
|
319
|
+
function stubFalse() {
|
320
|
+
return false;
|
321
|
+
}
|
322
|
+
|
323
|
+
/** Detect free variable `exports`. */
|
324
|
+
var freeExports$1 = typeof exports == 'object' && exports && !exports.nodeType && exports;
|
325
|
+
|
326
|
+
/** Detect free variable `module`. */
|
327
|
+
var freeModule$1 = freeExports$1 && typeof module == 'object' && module && !module.nodeType && module;
|
328
|
+
|
329
|
+
/** Detect the popular CommonJS extension `module.exports`. */
|
330
|
+
var moduleExports$1 = freeModule$1 && freeModule$1.exports === freeExports$1;
|
331
|
+
|
332
|
+
/** Built-in value references. */
|
333
|
+
var Buffer = moduleExports$1 ? root.Buffer : undefined;
|
334
|
+
|
335
|
+
/* Built-in method references for those with the same name as other `lodash` methods. */
|
336
|
+
var nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined;
|
337
|
+
|
338
|
+
/**
|
339
|
+
* Checks if `value` is a buffer.
|
340
|
+
*
|
341
|
+
* @static
|
342
|
+
* @memberOf _
|
343
|
+
* @since 4.3.0
|
344
|
+
* @category Lang
|
345
|
+
* @param {*} value The value to check.
|
346
|
+
* @returns {boolean} Returns `true` if `value` is a buffer, else `false`.
|
347
|
+
* @example
|
348
|
+
*
|
349
|
+
* _.isBuffer(new Buffer(2));
|
350
|
+
* // => true
|
351
|
+
*
|
352
|
+
* _.isBuffer(new Uint8Array(2));
|
353
|
+
* // => false
|
354
|
+
*/
|
355
|
+
var isBuffer = nativeIsBuffer || stubFalse;
|
356
|
+
|
357
|
+
/** `Object#toString` result references. */
|
358
|
+
var argsTag = '[object Arguments]',
|
359
|
+
arrayTag = '[object Array]',
|
360
|
+
boolTag = '[object Boolean]',
|
361
|
+
dateTag = '[object Date]',
|
362
|
+
errorTag = '[object Error]',
|
363
|
+
funcTag = '[object Function]',
|
364
|
+
mapTag = '[object Map]',
|
365
|
+
numberTag = '[object Number]',
|
366
|
+
objectTag = '[object Object]',
|
367
|
+
regexpTag = '[object RegExp]',
|
368
|
+
setTag = '[object Set]',
|
369
|
+
stringTag = '[object String]',
|
370
|
+
weakMapTag = '[object WeakMap]';
|
371
|
+
|
372
|
+
var arrayBufferTag = '[object ArrayBuffer]',
|
373
|
+
dataViewTag = '[object DataView]',
|
374
|
+
float32Tag = '[object Float32Array]',
|
375
|
+
float64Tag = '[object Float64Array]',
|
376
|
+
int8Tag = '[object Int8Array]',
|
377
|
+
int16Tag = '[object Int16Array]',
|
378
|
+
int32Tag = '[object Int32Array]',
|
379
|
+
uint8Tag = '[object Uint8Array]',
|
380
|
+
uint8ClampedTag = '[object Uint8ClampedArray]',
|
381
|
+
uint16Tag = '[object Uint16Array]',
|
382
|
+
uint32Tag = '[object Uint32Array]';
|
383
|
+
|
384
|
+
/** Used to identify `toStringTag` values of typed arrays. */
|
385
|
+
var typedArrayTags = {};
|
386
|
+
typedArrayTags[float32Tag] = typedArrayTags[float64Tag] =
|
387
|
+
typedArrayTags[int8Tag] = typedArrayTags[int16Tag] =
|
388
|
+
typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =
|
389
|
+
typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =
|
390
|
+
typedArrayTags[uint32Tag] = true;
|
391
|
+
typedArrayTags[argsTag] = typedArrayTags[arrayTag] =
|
392
|
+
typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =
|
393
|
+
typedArrayTags[dataViewTag] = typedArrayTags[dateTag] =
|
394
|
+
typedArrayTags[errorTag] = typedArrayTags[funcTag] =
|
395
|
+
typedArrayTags[mapTag] = typedArrayTags[numberTag] =
|
396
|
+
typedArrayTags[objectTag] = typedArrayTags[regexpTag] =
|
397
|
+
typedArrayTags[setTag] = typedArrayTags[stringTag] =
|
398
|
+
typedArrayTags[weakMapTag] = false;
|
399
|
+
|
400
|
+
/**
|
401
|
+
* The base implementation of `_.isTypedArray` without Node.js optimizations.
|
402
|
+
*
|
403
|
+
* @private
|
404
|
+
* @param {*} value The value to check.
|
405
|
+
* @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
|
406
|
+
*/
|
407
|
+
function baseIsTypedArray(value) {
|
408
|
+
return isObjectLike(value) &&
|
409
|
+
isLength(value.length) && !!typedArrayTags[baseGetTag(value)];
|
410
|
+
}
|
411
|
+
|
412
|
+
/**
|
413
|
+
* The base implementation of `_.unary` without support for storing metadata.
|
414
|
+
*
|
415
|
+
* @private
|
416
|
+
* @param {Function} func The function to cap arguments for.
|
417
|
+
* @returns {Function} Returns the new capped function.
|
418
|
+
*/
|
419
|
+
function baseUnary(func) {
|
420
|
+
return function(value) {
|
421
|
+
return func(value);
|
422
|
+
};
|
423
|
+
}
|
424
|
+
|
425
|
+
/** Detect free variable `exports`. */
|
426
|
+
var freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports;
|
427
|
+
|
428
|
+
/** Detect free variable `module`. */
|
429
|
+
var freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;
|
430
|
+
|
431
|
+
/** Detect the popular CommonJS extension `module.exports`. */
|
432
|
+
var moduleExports = freeModule && freeModule.exports === freeExports;
|
433
|
+
|
434
|
+
/** Detect free variable `process` from Node.js. */
|
435
|
+
var freeProcess = moduleExports && freeGlobal.process;
|
436
|
+
|
437
|
+
/** Used to access faster Node.js helpers. */
|
438
|
+
var nodeUtil = (function() {
|
439
|
+
try {
|
440
|
+
// Use `util.types` for Node.js 10+.
|
441
|
+
var types = freeModule && freeModule.require && freeModule.require('util').types;
|
442
|
+
|
443
|
+
if (types) {
|
444
|
+
return types;
|
445
|
+
}
|
446
|
+
|
447
|
+
// Legacy `process.binding('util')` for Node.js < 10.
|
448
|
+
return freeProcess && freeProcess.binding && freeProcess.binding('util');
|
449
|
+
} catch (e) {}
|
450
|
+
}());
|
451
|
+
|
452
|
+
/* Node.js helper references. */
|
453
|
+
var nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;
|
454
|
+
|
455
|
+
/**
|
456
|
+
* Checks if `value` is classified as a typed array.
|
457
|
+
*
|
458
|
+
* @static
|
459
|
+
* @memberOf _
|
460
|
+
* @since 3.0.0
|
461
|
+
* @category Lang
|
462
|
+
* @param {*} value The value to check.
|
463
|
+
* @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
|
464
|
+
* @example
|
465
|
+
*
|
466
|
+
* _.isTypedArray(new Uint8Array);
|
467
|
+
* // => true
|
468
|
+
*
|
469
|
+
* _.isTypedArray([]);
|
470
|
+
* // => false
|
471
|
+
*/
|
472
|
+
var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
|
473
|
+
|
474
|
+
/** Used for built-in method references. */
|
475
|
+
var objectProto$1 = Object.prototype;
|
476
|
+
|
477
|
+
/** Used to check objects for own properties. */
|
478
|
+
var hasOwnProperty$1 = objectProto$1.hasOwnProperty;
|
479
|
+
|
480
|
+
/**
|
481
|
+
* Creates an array of the enumerable property names of the array-like `value`.
|
482
|
+
*
|
483
|
+
* @private
|
484
|
+
* @param {*} value The value to query.
|
485
|
+
* @param {boolean} inherited Specify returning inherited property names.
|
486
|
+
* @returns {Array} Returns the array of property names.
|
487
|
+
*/
|
488
|
+
function arrayLikeKeys(value, inherited) {
|
489
|
+
var isArr = isArray(value),
|
490
|
+
isArg = !isArr && isArguments(value),
|
491
|
+
isBuff = !isArr && !isArg && isBuffer(value),
|
492
|
+
isType = !isArr && !isArg && !isBuff && isTypedArray(value),
|
493
|
+
skipIndexes = isArr || isArg || isBuff || isType,
|
494
|
+
result = skipIndexes ? baseTimes(value.length, String) : [],
|
495
|
+
length = result.length;
|
496
|
+
|
497
|
+
for (var key in value) {
|
498
|
+
if ((inherited || hasOwnProperty$1.call(value, key)) &&
|
499
|
+
!(skipIndexes && (
|
500
|
+
// Safari 9 has enumerable `arguments.length` in strict mode.
|
501
|
+
key == 'length' ||
|
502
|
+
// Node.js 0.10 has enumerable non-index properties on buffers.
|
503
|
+
(isBuff && (key == 'offset' || key == 'parent')) ||
|
504
|
+
// PhantomJS 2 has enumerable non-index properties on typed arrays.
|
505
|
+
(isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) ||
|
506
|
+
// Skip index properties.
|
507
|
+
isIndex(key, length)
|
508
|
+
))) {
|
509
|
+
result.push(key);
|
510
|
+
}
|
511
|
+
}
|
512
|
+
return result;
|
513
|
+
}
|
514
|
+
|
515
|
+
/**
|
516
|
+
* This function is like
|
517
|
+
* [`Object.keys`](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
|
518
|
+
* except that it includes inherited enumerable properties.
|
519
|
+
*
|
520
|
+
* @private
|
521
|
+
* @param {Object} object The object to query.
|
522
|
+
* @returns {Array} Returns the array of property names.
|
523
|
+
*/
|
524
|
+
function nativeKeysIn(object) {
|
525
|
+
var result = [];
|
526
|
+
if (object != null) {
|
527
|
+
for (var key in Object(object)) {
|
528
|
+
result.push(key);
|
529
|
+
}
|
530
|
+
}
|
531
|
+
return result;
|
532
|
+
}
|
533
|
+
|
534
|
+
/** Used for built-in method references. */
|
535
|
+
var objectProto = Object.prototype;
|
536
|
+
|
537
|
+
/** Used to check objects for own properties. */
|
538
|
+
var hasOwnProperty = objectProto.hasOwnProperty;
|
539
|
+
|
540
|
+
/**
|
541
|
+
* The base implementation of `_.keysIn` which doesn't treat sparse arrays as dense.
|
542
|
+
*
|
543
|
+
* @private
|
544
|
+
* @param {Object} object The object to query.
|
545
|
+
* @returns {Array} Returns the array of property names.
|
546
|
+
*/
|
547
|
+
function baseKeysIn(object) {
|
548
|
+
if (!isObject(object)) {
|
549
|
+
return nativeKeysIn(object);
|
550
|
+
}
|
551
|
+
var isProto = isPrototype(object),
|
552
|
+
result = [];
|
553
|
+
|
554
|
+
for (var key in object) {
|
555
|
+
if (!(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) {
|
556
|
+
result.push(key);
|
557
|
+
}
|
558
|
+
}
|
559
|
+
return result;
|
560
|
+
}
|
561
|
+
|
562
|
+
/**
|
563
|
+
* Creates an array of the own and inherited enumerable property names of `object`.
|
564
|
+
*
|
565
|
+
* **Note:** Non-object values are coerced to objects.
|
566
|
+
*
|
567
|
+
* @static
|
568
|
+
* @memberOf _
|
569
|
+
* @since 3.0.0
|
570
|
+
* @category Object
|
571
|
+
* @param {Object} object The object to query.
|
572
|
+
* @returns {Array} Returns the array of property names.
|
573
|
+
* @example
|
574
|
+
*
|
575
|
+
* function Foo() {
|
576
|
+
* this.a = 1;
|
577
|
+
* this.b = 2;
|
578
|
+
* }
|
579
|
+
*
|
580
|
+
* Foo.prototype.c = 3;
|
581
|
+
*
|
582
|
+
* _.keysIn(new Foo);
|
583
|
+
* // => ['a', 'b', 'c'] (iteration order is not guaranteed)
|
584
|
+
*/
|
585
|
+
function keysIn(object) {
|
586
|
+
return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object);
|
587
|
+
}
|
588
|
+
|
589
|
+
/**
|
590
|
+
* Converts `value` to a string. An empty string is returned for `null`
|
591
|
+
* and `undefined` values. The sign of `-0` is preserved.
|
592
|
+
*
|
593
|
+
* @static
|
594
|
+
* @memberOf _
|
595
|
+
* @since 4.0.0
|
596
|
+
* @category Lang
|
597
|
+
* @param {*} value The value to convert.
|
598
|
+
* @returns {string} Returns the converted string.
|
599
|
+
* @example
|
600
|
+
*
|
601
|
+
* _.toString(null);
|
602
|
+
* // => ''
|
603
|
+
*
|
604
|
+
* _.toString(-0);
|
605
|
+
* // => '-0'
|
606
|
+
*
|
607
|
+
* _.toString([1, 2, 3]);
|
608
|
+
* // => '1,2,3'
|
609
|
+
*/
|
610
|
+
function toString(value) {
|
611
|
+
return value == null ? '' : baseToString(value);
|
612
|
+
}
|
613
|
+
|
614
|
+
/**
|
615
|
+
* Creates a base function for methods like `_.forIn` and `_.forOwn`.
|
616
|
+
*
|
617
|
+
* @private
|
618
|
+
* @param {boolean} [fromRight] Specify iterating from right to left.
|
619
|
+
* @returns {Function} Returns the new base function.
|
620
|
+
*/
|
621
|
+
function createBaseFor(fromRight) {
|
622
|
+
return function(object, iteratee, keysFunc) {
|
623
|
+
var index = -1,
|
624
|
+
iterable = Object(object),
|
625
|
+
props = keysFunc(object),
|
626
|
+
length = props.length;
|
627
|
+
|
628
|
+
while (length--) {
|
629
|
+
var key = props[fromRight ? length : ++index];
|
630
|
+
if (iteratee(iterable[key], key, iterable) === false) {
|
631
|
+
break;
|
632
|
+
}
|
633
|
+
}
|
634
|
+
return object;
|
635
|
+
};
|
636
|
+
}
|
637
|
+
|
638
|
+
/**
|
639
|
+
* The base implementation of `baseForOwn` which iterates over `object`
|
640
|
+
* properties returned by `keysFunc` and invokes `iteratee` for each property.
|
641
|
+
* Iteratee functions may exit iteration early by explicitly returning `false`.
|
642
|
+
*
|
643
|
+
* @private
|
644
|
+
* @param {Object} object The object to iterate over.
|
645
|
+
* @param {Function} iteratee The function invoked per iteration.
|
646
|
+
* @param {Function} keysFunc The function to get the keys of `object`.
|
647
|
+
* @returns {Object} Returns `object`.
|
648
|
+
*/
|
649
|
+
var baseFor = createBaseFor();
|
650
|
+
|
651
|
+
/**
|
652
|
+
* Casts `value` to `identity` if it's not a function.
|
653
|
+
*
|
654
|
+
* @private
|
655
|
+
* @param {*} value The value to inspect.
|
656
|
+
* @returns {Function} Returns cast function.
|
657
|
+
*/
|
658
|
+
function castFunction(value) {
|
659
|
+
return typeof value == 'function' ? value : identity;
|
660
|
+
}
|
661
|
+
|
662
|
+
/**
|
663
|
+
* Used to match `RegExp`
|
664
|
+
* [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
|
665
|
+
*/
|
666
|
+
var reRegExpChar = /[\\^$.*+?()[\]{}|]/g,
|
667
|
+
reHasRegExpChar = RegExp(reRegExpChar.source);
|
668
|
+
|
669
|
+
/**
|
670
|
+
* Escapes the `RegExp` special characters "^", "$", "\", ".", "*", "+",
|
671
|
+
* "?", "(", ")", "[", "]", "{", "}", and "|" in `string`.
|
672
|
+
*
|
673
|
+
* @static
|
674
|
+
* @memberOf _
|
675
|
+
* @since 3.0.0
|
676
|
+
* @category String
|
677
|
+
* @param {string} [string=''] The string to escape.
|
678
|
+
* @returns {string} Returns the escaped string.
|
679
|
+
* @example
|
680
|
+
*
|
681
|
+
* _.escapeRegExp('[lodash](https://lodash.com/)');
|
682
|
+
* // => '\[lodash\]\(https://lodash\.com/\)'
|
683
|
+
*/
|
684
|
+
function escapeRegExp(string) {
|
685
|
+
string = toString(string);
|
686
|
+
return (string && reHasRegExpChar.test(string))
|
687
|
+
? string.replace(reRegExpChar, '\\$&')
|
688
|
+
: string;
|
689
|
+
}
|
690
|
+
|
691
|
+
/**
|
692
|
+
* Iterates over own and inherited enumerable string keyed properties of an
|
693
|
+
* object and invokes `iteratee` for each property. The iteratee is invoked
|
694
|
+
* with three arguments: (value, key, object). Iteratee functions may exit
|
695
|
+
* iteration early by explicitly returning `false`.
|
696
|
+
*
|
697
|
+
* @static
|
698
|
+
* @memberOf _
|
699
|
+
* @since 0.3.0
|
700
|
+
* @category Object
|
701
|
+
* @param {Object} object The object to iterate over.
|
702
|
+
* @param {Function} [iteratee=_.identity] The function invoked per iteration.
|
703
|
+
* @returns {Object} Returns `object`.
|
704
|
+
* @see _.forInRight
|
705
|
+
* @example
|
706
|
+
*
|
707
|
+
* function Foo() {
|
708
|
+
* this.a = 1;
|
709
|
+
* this.b = 2;
|
710
|
+
* }
|
711
|
+
*
|
712
|
+
* Foo.prototype.c = 3;
|
713
|
+
*
|
714
|
+
* _.forIn(new Foo, function(value, key) {
|
715
|
+
* console.log(key);
|
716
|
+
* });
|
717
|
+
* // => Logs 'a', 'b', then 'c' (iteration order is not guaranteed).
|
718
|
+
*/
|
719
|
+
function forIn(object, iteratee) {
|
720
|
+
return object == null
|
721
|
+
? object
|
722
|
+
: baseFor(object, castFunction(iteratee), keysIn);
|
723
|
+
}
|
724
|
+
|
725
|
+
/*!
|
726
|
+
* All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
727
|
+
* See https://github.com/Esri/calcite-components/blob/master/LICENSE.md for details.
|
728
|
+
* v1.0.0-beta.97
|
729
|
+
*/
|
730
|
+
const filter = (data, value) => {
|
731
|
+
const escapedValue = escapeRegExp(value);
|
732
|
+
const regex = new RegExp(escapedValue, "i");
|
733
|
+
if (data.length === 0) {
|
734
|
+
console.warn(`No data was passed to the filter function.
|
735
|
+
The data argument should be an array of objects`);
|
736
|
+
}
|
737
|
+
const find = (input, RE) => {
|
738
|
+
if ((input === null || input === void 0 ? void 0 : input.constant) || (input === null || input === void 0 ? void 0 : input.filterDisabled)) {
|
739
|
+
return true;
|
740
|
+
}
|
741
|
+
let found = false;
|
742
|
+
forIn(input, (val) => {
|
743
|
+
if (typeof val === "function" || val == null /* intentional == to catch undefined */) {
|
744
|
+
return;
|
745
|
+
}
|
746
|
+
if (Array.isArray(val) || (typeof val === "object" && val !== null)) {
|
747
|
+
if (find(val, RE)) {
|
748
|
+
found = true;
|
749
|
+
}
|
750
|
+
}
|
751
|
+
else if (RE.test(val)) {
|
752
|
+
found = true;
|
753
|
+
}
|
754
|
+
});
|
755
|
+
return found;
|
756
|
+
};
|
757
|
+
const result = data.filter((item) => {
|
758
|
+
return find(item, regex);
|
759
|
+
});
|
760
|
+
return result;
|
761
|
+
};
|
762
|
+
|
763
|
+
export { filter as f };
|