Registry / type-stubs / over
library0.0.5jsnpmunverified

over is a JavaScript library designed to facilitate function overloading, allowing developers to define multiple implementations for a single function based on the arguments provided during invocation. It operates by accepting an array of 'test functions' (such as `over.string`, `over.numberOptionalWithDefault`, `over.callbackOptional`), which are used to match the types and presence of input arguments against predefined patterns. This enables complex argument signature management, default values for optional parameters, and callback handling in a structured way. The package is currently at version `0.0.5`, with its last significant activity in 2013, and the copyright dates back to 2012. This strongly suggests the project is abandoned, with no active development or maintenance. Its core differentiator was providing a declarative approach to function dispatch in a pre-ESM and pre-TypeScript era, often mitigating verbose `if`/`else` or switch statements for argument validation. It primarily targets Node.js environments.

npm install over
INSTALL
IMPORT
SIG · OVER
O
over
type-stubsjavascriptv0.0.5
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

over
const over = require('over');
import over from 'over';
This package primarily supports CommonJS due to its age (last updated ~2013). Direct ES Module (ESM) import is not supported.
over.string
const over = require('over'); const myFn = over([over.string, function (str) { /* ... */ }]);
import { string } from 'over';
Built-in test functions like `over.string` are properties of the default `over` export (a function) and are not individually named exports.

Demonstrates defining multiple function overloads using `over` with various argument matchers, including optional parameters with defaults and callbacks, then calling the overloaded function with different argument sets to show matching behavior.

const over = require('over'); const myfn = over([ [over.string, function (str) { console.log('Called with a single string:', str); }], [over.string, over.numberOptionalWithDefault(5), over.callbackOptional, function (str, number, callback) { console.log('Called with string, optional number (default 5), and optional callback.'); console.log('String:', str, 'Number:', number); if (callback) { console.log('Executing callback...'); callback(str, number); } }], function() { console.log('No specific overload matched. Falling back to default.'); } ]); // Test cases myfn("hello"); myfn("world", 10, (s, n) => console.log(`Callback invoked: ${s}, ${n}`)); myfn("test", null, (s, n) => console.log(`Callback invoked with null number: ${s}, ${n}`)); // numberOptionalWithDefault should handle null/undefined myfn("another test", undefined, (s, n) => console.log(`Callback invoked with undefined number: ${s}, ${n}`)); myfn(); // Should hit default
Debug
Known issues
breakingThis package appears to be abandoned since 2013 and is no longer maintained. Using an unmaintained library introduces significant security risks, as it will not receive patches for vulnerabilities or updates for compatibility with modern JavaScript runtimes or security standards.
fix
Evaluate modern alternatives for function overloading or implement pattern matching manually using contemporary JavaScript features. Consider using TypeScript's built-in overloading capabilities for type-safe overloading.
affects: >=0.0.5
gotchaThe package was developed for CommonJS environments and does not natively support ES Modules (ESM). Attempting to `import over from 'over';` in an ESM context will likely result in errors like `ERR_REQUIRE_ESM` or `over is not defined`.
fix
If you must use this package in an ESM project, consider dynamic `import()` or wrapper CJS modules, but prefer refactoring to avoid this dependency in modern applications.
affects: >=0.0.5
gotchaDue to its age, `over` may exhibit compatibility issues with newer Node.js versions, particularly those released after 2013. Behavior might be undefined or lead to runtime errors, especially with changes in core APIs or internal JavaScript engine optimizations.
fix
Thoroughly test the package in your specific Node.js environment. Consider containerizing applications to pin Node.js versions if legacy dependencies are unavoidable, but a full refactor is recommended.
affects: >=0.0.5
Errors
Common errors & fixes
ReferenceError: require is not defined
Attempting to use `require()` in an ES Module context (e.g., in a `.mjs` file or a `.js` file where `"type": "module"` is set in `package.json`).
fix
Change your module to CommonJS by ensuring it's a `.js` file and not declared as an ES Module in `package.json`, or use a dynamic `import()` if absolutely necessary: `const over = await import('over');`.
TypeError: over is not a function
Incorrectly attempting to use named imports or default ES Module imports (`import over from 'over';`) in an environment where `over` only provides a CommonJS export.
fix
Ensure you are using the correct CommonJS `require` syntax for importing the package: `const over = require('over');`.
Upgrade
Version history
0.0.5latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
12 hits · last 30 days
node
10
Amazon
1
OpenAI (training)
1
Resources
over — npm install over · libregistry