import { Props } from "../types.d.ts";
import { h } from "../jsx.ts";

interface BaseScriptProps extends Props {
    // deno-lint-ignore ban-types
    function?: Function;
    // deno-lint-ignore no-explicit-any
    children?: any;
}

export default (props: BaseScriptProps) => (
    <script>
        {props.function ? `(${props.function.toString()})();` : undefined}
        {props.children ?? undefined}
    </script>
);
