+9
-8
lines changedFilter options
+9
-8
lines changed Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
1
+
import get from '../utils/get'
1
2
import { stripTags } from '../utils/html'
2
3
import { isArray, isPlainObject, isUndefined } from '../utils/inspect'
3
4
import { keys } from '../utils/object'
@@ -40,13 +41,13 @@ export default {
40
41
// Normalize flat-ish arrays to Array of Objects
41
42
return options.map(option => {
42
43
if (isPlainObject(option)) {
43
-
const value = option[valueField]
44
-
const text = String(option[textField])
44
+
const value = get(option, valueField)
45
+
const text = String(get(option, textField))
45
46
return {
46
47
value: isUndefined(value) ? text : value,
47
48
text: stripTags(text),
48
-
html: option[htmlField],
49
-
disabled: Boolean(option[disabledField])
49
+
html: get(option, htmlField),
50
+
disabled: Boolean(get(option, disabledField))
50
51
}
51
52
}
52
53
return {
@@ -61,13 +62,13 @@ export default {
61
62
return keys(options).map(key => {
62
63
const option = options[key] || {}
63
64
if (isPlainObject(option)) {
64
-
const value = option[valueField]
65
-
const text = option[textField]
65
+
const value = get(option, valueField)
66
+
const text = get(option, textField)
66
67
return {
67
68
value: isUndefined(value) ? key : value,
68
69
text: isUndefined(text) ? stripTags(String(key)) : stripTags(String(text)),
69
-
html: option[htmlField],
70
-
disabled: Boolean(option[disabledField])
70
+
html: get(option, htmlField),
71
+
disabled: Boolean(get(option, disabledField))
71
72
}
72
73
}
73
74
return {
You can’t perform that action at this time.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4