-
Notifications
You must be signed in to change notification settings - Fork 143
Open
Description
I'd expect isGetter
to assert that a getter is valid (e.g. composed only of strings, optionally a trailing function, or other getters). Instead, it tests that an array ends in a function.
Valid getters that fail this test
["path"]
Invalid getters that pass
[1, true, null, () => ({})]
A more robust test
function isGetter(value) {
return isArray(value) && value.every(
(item, i) => isString(item)
|| (i === value.length - 1 && isFunction(item))
|| isGetter(item)
);
}
It passes all the current getter tests.