Registry / serialization / gextend

gextend

JSON →
library0.8.0jsnpmunverified

GExtend is a concise utility module designed for robust object extension, supporting both Node.js and browser environments. The package, currently at version 0.8.0, provides a flexible `extend` function to merge properties from multiple source objects into a target object, analogous to `jQuery.extend` or `Object.assign`. It includes specialized methods like `extend.only` for selective property merging, `extend.shim` to safely wrap objects (e.g., `console`) without direct modification, and `extend.unshim` for reverting shims, making it suitable for creating configurable and insulated class instances. Despite its utility, the project appears to be largely unmaintained, with its last recorded release history updates dating back to 2019. Its primary distribution method and usage patterns predate modern JavaScript module conventions, relying heavily on CommonJS and mentioning Bower for frontend integration.

npm install gextend
INSTALL
IMPORT
SIG · GEXTEND
G
gextend
serializationjavascriptv0.8.0
Install
—
Import
—
Disk
—
Pass rate
0/ 6
Env Coverage0 / 6
glibc
18–22
musl
18–22
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 18–226 runs
build_error
glibc
node 18–226 runs
build_error
Code
Verified usage

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

extend
✓ const extend = require('gextend');
✗ import extend from 'gextend';
Primary usage pattern for this CommonJS-first library. The 'extend' symbol is an object/function.
extend (ESM compatibility)
✓ import * as extend from 'gextend';
✗ import { extend } from 'gextend';
For modern ESM environments, `import * as` is the most reliable way to import a CommonJS module that exports a function/object directly. A direct default import (`import extend from 'gextend';`) might not work without specific transpiler/Node.js configurations for CJS interop.
extend.only, extend.shim, extend.unshim
✓ const extend = require('gextend'); // ... later ... extend.only(attributes);
✗ import { only, shim } from 'gextend';
These are methods on the `extend` object itself, not separate named exports. Access them via the main `extend` import.

Demonstrates the core object extension functionality, showing how to merge default configuration with user-provided options to create a final, immutable configuration object for a `connect` function.

const extend = require('gextend'); const DEFAULTS = { port: 9090, url: 'http://localhost' }; function connect(options){ // Merges options into DEFAULTS, then into a new empty object. // The empty object {} ensures DEFAULTS is not mutated. let config = extend({}, DEFAULTS, options); console.log('Connect to %s:%s', config.url, config.port); } // Example usage connect({ url: 'http://127.0.0.1' }); connect({ port: 8080 }); connect({});
Debug
Known issues
breakingStarting with v0.4.0, the `extend` function changed its behavior when handling functions during merging. Previously, functions might have been extended, but now they are overwritten directly, which can change object behavior if you were relying on function merging.
fix
Review existing code that extends objects containing functions and adjust expectations or implementation if function merging was previously desired. Functions will now be replaced, not merged.
affects: >=0.4.0
gotchaThe `gextend` package appears to be an abandoned project. Its last activity in the release history dates back to 2019, and it references deprecated tools like Bower.js. This implies no active maintenance, security updates, or feature development, making it potentially unsuitable for new projects or critical applications.
fix
For new projects, consider using actively maintained alternatives like `Object.assign()` (native ES6), Lodash's `_.merge()` or `_.defaults()`, or other modern utility libraries. For existing projects, be aware of the lack of updates.
affects: >=0.6.0
gotchaGExtend is primarily a CommonJS (CJS) module. While it can be used in modern Node.js ESM environments via interoperability layers, direct `import extend from 'gextend';` might not work as expected without specific `type: 'module'` in `package.json` and/or bundler configurations.
fix
In CJS environments, use `const extend = require('gextend');`. In ESM, use `import * as extend from 'gextend';` or rely on a bundler to handle CJS module resolution.
affects: all
deprecatedThe README extensively mentions and provides instructions for Bower, a package manager for the web that has largely been superseded by npm and Yarn for frontend dependency management. This further highlights the package's age and lack of modern tooling adoption.
fix
Do not attempt to install or manage `gextend` via Bower. Use npm (`npm install gextend`) or Yarn (`yarn add gextend`) instead.
affects: all
Errors
Common errors & fixes
Error: Cannot find module 'gextend'
The package 'gextend' has not been installed, or the CommonJS `require()` path is incorrect, or you are trying to use an ESM `import` in a context where it's not resolved properly.
fix
First, ensure the package is installed: `npm install gextend`. If using ESM, try `import * as extend from 'gextend';` or verify your build configuration supports CJS module interoperability.
TypeError: extend is not a function
This usually occurs when attempting to call `extend()` directly after an incorrect `import` statement in an ESM context, or if the `require('gextend')` result is not assigned to a variable named `extend`.
fix
Verify that you are using `const extend = require('gextend');` in CommonJS. If in ESM, ensure you are importing it as an object (e.g., `import * as extend from 'gextend';`) and then calling `extend.default()` or `extend({}, ...)` if it exposes itself as the default.
EACCES: permission denied, mkdir '/usr/local/lib/node_modules/gextend'
This error, often seen on older Node.js setups, indicates insufficient permissions for npm to write to global installation directories, typically `/usr/local/lib/node_modules`.
fix
Avoid using `sudo npm install -g` as it can lead to permission issues. Instead, fix permissions by running `sudo chown -R $(whoami) $(npm config get prefix)/{lib/node_modules,bin,share}` or, preferably, use a Node Version Manager (like nvm) to manage Node.js versions and packages without requiring `sudo`.
Upgrade
Version history
0.8.0latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
4 hits · last 30 days
node
4
Resources