Skip to content

Commit

Permalink
fix: prevent recursion with pushing keys
Browse files Browse the repository at this point in the history
  • Loading branch information
titanism committed Sep 12, 2023
1 parent 49f0e19 commit d8388d6
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ Axe will automatically add the following metadata and information to the `meta`

Axe will omit from metadata all properties via the default Array from `meta.omittedFields` option (see [Options](#options) below for more insight).

If the argument "meta" is an empty object, then it will not be passed as an argument to logger methods \*ndash; because you don't want to see an empty `{}` polluting your log metadata. Axe keeps your log output tidy.
If the argument "meta" is an empty object, then it will not be passed as an argument to logger methods because you don't want to see an empty `{}` polluting your log metadata. Axe keeps your log output tidy.

```sh
hello world {
Expand Down
4 changes: 2 additions & 2 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,10 @@ function dotifyToArray(obj) {
: key;
const newKey = current ? current + '.' + convertedKey : convertedKey; // joined key with dot
// if (value && typeof value === 'object' && !(value instanceof Date) && !ObjectID.isValid(value)) {
if (isPlainObject(value)) {
if (isPlainObject(value) && res.indexOf(convertedKey) === -1) {
res.push(convertedKey);
recurse(value, newKey); // it's a nested object, so do it again
} else {
} else if (res.indexOf(newKey) === -1) {
res.push(newKey);
}
}
Expand Down

0 comments on commit d8388d6

Please sign in to comment.