However, this leads to the error:
TypeError: Cannot read property 'filter' of undefined
at this function:
function filter(path, fn) {
return macro(obj => getPath(obj, path).filter(fn));
}
Shouldn't this library be checking if the underlying array is null or undefined before assuming any further method can be called on the object?
Or to put it another way: Is there a way to make this work? I have added a constructor which initialises inviteLinks with an empty array, because I was having the same issue when only using the sortBy decorator. That solved the issue, but as soon as I added the filter decorator, it came back - but this time I have no idea how to work around this, as I think I shouldn't be setting the decorated variable sortedLinks to an empty array, to work around this issue.
I am trying to define a filter that depends on a sort decorator:
However, this leads to the error:
TypeError: Cannot read property 'filter' of undefined
at this function:
Shouldn't this library be checking if the underlying array is null or undefined before assuming any further method can be called on the object?
Or to put it another way: Is there a way to make this work? I have added a constructor which initialises
inviteLinks
with an empty array, because I was having the same issue when only using the sortBy decorator. That solved the issue, but as soon as I added the filter decorator, it came back - but this time I have no idea how to work around this, as I think I shouldn't be setting the decorated variablesortedLinks
to an empty array, to work around this issue.