Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Gally]: master <- dev #1067

Merged
merged 3 commits into from
Jul 25, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 0 additions & 7 deletions .idea/jsLinters/eslint.xml

This file was deleted.

14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,13 @@ Default: `├─ `

Prefix for key when a further neighbour is present.

#### renderFn

Type: `function`<br>
Default: ``(node) => (['boolean', 'string', 'number'].includes(typeof node) ? `: ${node}` : '')``

Can be used to overwrite the node rendering logic.

#### sortFn

Type: `function`<br>
Expand All @@ -123,13 +130,6 @@ Default: ` (circular ref.)`

When `string`, circular references are broken with that string, at a minor performance cost.

#### renderFn

Type: `function`<br>
Default: `(node) => (['boolean', 'string', 'number'].includes(typeof node) ? `: ${node}` : '')`

Can be used to overwrite the node rendering logic.

## Examples

More examples can be found in the tests.
4 changes: 2 additions & 2 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ const buildCtx = (opts) => {
spacerNeighbour: '│ ',
keyNoNeighbour: '└─ ',
keyNeighbour: '├─ ',
renderFn: (node) => (['boolean', 'string', 'number'].includes(typeof node) ? `: ${node}` : ''),
sortFn: null,
breakCircularWith: ' (circular ref.)',
renderFn: (node) => (['boolean', 'string', 'number'].includes(typeof node) ? `: ${node}` : ''),
...opts
};
assert(Object.keys(ctx).length === 8, 'Unexpected Option(s) provided');
Expand All @@ -18,12 +18,12 @@ const buildCtx = (opts) => {
assert(typeof ctx.spacerNeighbour === 'string', 'Option "spacerNeighbour" has invalid format');
assert(typeof ctx.keyNoNeighbour === 'string', 'Option "keyNoNeighbour" has invalid format');
assert(typeof ctx.keyNeighbour === 'string', 'Option "keyNeighbour" has invalid format');
assert(typeof ctx.renderFn === 'function', 'Option "renderFn" has invalid format');
assert(typeof ctx.sortFn === 'function' || ctx.sortFn === null, 'Option "sortFn" has invalid format');
assert(
typeof ctx.breakCircularWith === 'string' || ctx.breakCircularWith === null,
'Option "breakCircularWith" has invalid format'
);
assert(typeof ctx.renderFn === 'function', 'Option "renderFn" has invalid format');
return ctx;
};

Expand Down