Skip to content

Commit

Permalink
up
Browse files Browse the repository at this point in the history
  • Loading branch information
clement-berard committed Jan 10, 2025
1 parent 9e2700d commit 7668c73
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 9 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -210,15 +210,15 @@ All used libraries are treeshaked and included in the final bundle.

`Ip Information`


Fetches detailed information about an IP address

`Ip Version`


Returns IP version (4, 6, or 0 if invalid) for a given IP address string

`Network Interfaces`


Lists all network interfaces of the current machine (ethernet, wifi, etc.)

### → Object Utilities

Expand Down
17 changes: 14 additions & 3 deletions src/common/list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -179,12 +179,15 @@ export const list: UtilityList = {
},
network_utilities: {
ipInformation: {
description: 'Fetches detailed information about an IP address',
docs: 'By default is your current IP address',
},
ipVersion: {
docs: '4 or 6. 0 if invalid',
description: 'Returns IP version (4, 6, or 0 if invalid) for a given IP address string',
},
networkInterfaces: {
description: 'Lists all network interfaces of the current machine (ethernet, wifi, etc.)',
},
networkInterfaces: {},
},
math_utilities: {
abs: {},
Expand Down Expand Up @@ -231,5 +234,13 @@ export function getFunctionsFromCategory(category: string) {
}

export function getFunctionDetails(category: string, fn: string) {
return list?.[category]?.[fn];
const foundFn = list?.[category]?.[fn];
return {
...foundFn,
nodeDocs: `
${foundFn?.description || ''}
<br><br>
${foundFn?.docs || ''}
`.trim(),
};
}
8 changes: 5 additions & 3 deletions src/nodes/main/editor/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,11 @@ const Main: NodeEditorDefinition<NodeMainProps> = {
// force hide optionals fields
jqSelector('.extra-field').addClass('!hidden');
//docs part
const docs = fnDetails?.docs;
if (docs) {
jqSelector('.fn-docs').html(docs).removeClass('!hidden');
const docs = fnDetails?.nodeDocs;
if (docs.replace(/(<br>|\n)/g, '').trim()) {
jqSelector('.fn-docs')
.html(docs.replace(/^(<br\s*\/?>|\n)+|(<br\s*\/?>|\n)+$/g, ''))
.removeClass('!hidden');
}
// additional values part
const hasMainValue = !!fnDetails?.mainValue;
Expand Down

0 comments on commit 7668c73

Please sign in to comment.