Skip to content

FunctionData

paige edited this page Nov 17, 2023 · 6 revisions

type for function data
type: Class

arguments:

  • sync Boolean
    tells it if it should fetch in sync or not
  • f Function
    function input to fetch from
    works with most functions
  • ?callback Function
    optional function that runs when the function data is fetched
  • ?catcher Function
    optional function that catches errors

Methods

Type

Description

πŸ›ˆ then() Function adds a new data listener
πŸ›ˆ catch() Function adds a new error listener

Properties

Type

Description

πŸ›ˆ pending Boolean if the data is pending or not
πŸ›ˆ name String fetched name of the function
πŸ›ˆ dataName String name of the given function
πŸ›ˆ body String body of the function
πŸ›ˆ arguments Object function arguments
πŸ›ˆ isAsync Boolean if the function is an async function
πŸ›ˆ isArrow Boolean if the function is an arrow function
πŸ›ˆ data Function the given function
πŸ›ˆ string String the given function as a string

JS Output
const { FunctionData } = require('fndt');


function test(a, b="placeholder") {       
    console.log(a, b);
}


new FunctionData(false, test, (data) => {
    console.log(data);
});
FunctionData {
    pending: false,
    name: "test",
    dataName: "test",
    body: "console.log(a, b);",
    arguments: { a: null, b: "placeholder" },
    data: Function,
    string: "function test(a, b="placeholder") {
        console.log(a, b);
    }"
}


fndt docs

πŸ›ˆ FunctionData

πŸ›ˆ fetch()

πŸ›ˆ fetchSync()

Clone this wiki locally