whatisgithub

What is custom-function?

patrickjs/custom-function — explained in plain English

Analysis updated 2026-07-17 · repo last pushed 2024-11-05

1Audience · developerComplexity · 3/5StaleSetup · easy

In one sentence

A small library that lets you create custom functions with class-like features (methods, private fields, super calls) without unsafely extending Function.

Mindmap

mindmap
  root((custom-function))
    Inputs
      Plain function
      Any constructor
    Outputs
      Callable class-like object
      Extended constructors
    Use Cases
      Build callable validators
      Extend HTMLDivElement
    Tech Stack
      JavaScript
    Audience
      Developer

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

What do people build with it?

USE CASE 1

Build a callable validator function that also exposes methods like .withMessage() or .optional().

USE CASE 2

Give a function private fields, getters, setters, and super calls like a regular class.

USE CASE 3

Use the factory export to safely extend other hard-to-extend constructors, like HTMLDivElement.

USE CASE 4

Build a DSL where functions need to behave like objects with internal state.

What is it built with?

JavaScript

How does it compare?

patrickjs/custom-function0xkinno/neuralvault0xmayurrr/ai-contractauditor
Stars111
LanguageTypeScriptTypeScript
Last pushed2024-11-05
MaintenanceStale
Setup difficultyeasyhardeasy
Complexity3/54/52/5
Audiencedeveloperdeveloperdeveloper

Figures from each repo's GitHub metadata at analysis time.

How do you get it running?

Difficulty · easy Time to first run · 30min

Aimed at framework/library authors rather than typical app developers.

License is not stated in the available content.

Copy-paste prompts

Prompt 1
Show me how to use this custom-function library to make a callable validator with a .withMessage() method.
Prompt 2
Explain how this library avoids calling the real Function constructor while still giving functions class features.
Prompt 3
Help me use the factory export from this repo to extend HTMLDivElement safely.
Prompt 4
Compare this library's approach to using Object.defineProperties for adding methods to a function.

Frequently asked questions

What is custom-function?

A small library that lets you create custom functions with class-like features (methods, private fields, super calls) without unsafely extending Function.

Is custom-function actively maintained?

Stale — no commits in 1-2 years (last push 2024-11-05).

What license does custom-function use?

License is not stated in the available content.

How hard is custom-function to set up?

Setup difficulty is rated easy, with roughly 30min to a first successful run.

Who is custom-function for?

Mainly developer.

Open on GitHub → Ask about another repo

This repo across BitVibe Labs

Verify against the repo before relying on details.