Steps to reproduce
Create a custom service and return an array of arrays, from the find method:
async find(params?: Params): Promise<number[][]> {
return [
[ 1, 2, 3, 4 ]
];
}
Add a protect hook from the @feathersjs/authentication-local package as after-hook to the global app hooks. Protect any field.
after: {
all: [
protect('field')
],
find: [],
get: [],
create: [],
update: [],
patch: [],
remove: []
}
The result will be
[
{ 0: 1, 1: 2, 2: 3, 3: 4 }
]
The source of this problem lies in these lines of the protect hook:
|
const o = (current: any) => { |
|
const data = typeof current.toJSON === 'function' |
|
? current.toJSON() : current; |
|
return omit(data, fields); |
|
}; |
Here you invoke
_.omit on an array which leads to this result.