watson/shallow-clone-shim — explained in plain English
Analysis updated 2026-07-18 · repo last pushed 2019-10-31
Safely override a few specific property behaviors on a JavaScript object while keeping everything else intact.
Add logging or tracking around an existing property getter without modifying the original object.
Create a modified copy of a configuration object where one computed property returns a different value.
| watson/shallow-clone-shim | amarjitjim/browserpilot | andershaig/cssess | |
|---|---|---|---|
| Stars | 3 | 3 | 3 |
| Language | JavaScript | JavaScript | JavaScript |
| Last pushed | 2019-10-31 | — | 2011-08-19 |
| Maintenance | Dormant | — | Dormant |
| Setup difficulty | easy | moderate | easy |
| Complexity | 2/5 | 3/5 | 1/5 |
| Audience | developer | developer | developer |
Figures from each repo's GitHub metadata at analysis time.
Install via npm and require it directly, no external dependencies or configuration needed.
shallow-clone-shim is a small JavaScript utility that makes a copy of an object while preserving all the behind-the-scenes rules attached to its properties. In JavaScript, properties on an object can carry hidden metadata, like whether a property is read-only, whether it shows up in loops, or whether it runs a function (a "getter") every time you access it. Most simple cloning methods ignore this metadata, which can lead to copies that behave differently from the original. This tool copies everything faithfully. The library also gives you an optional way to tweak specific properties as they're being copied. You can pass in a set of instructions that intercepts individual properties and modifies how they work in the new copy. For example, if the original object has a property that always returns the number 2, you can instruct the clone to make that same property return 3 instead, all without touching the original object. This is useful when you want most of an object to stay the same but need to override a few specific behaviors. Someone building a JavaScript library or application might reach for this when they need to safely override or extend the behavior of an existing object without risking unintended side effects. A common scenario would be wrapping or intercepting how certain values are accessed, say, adding logging around a getter, or changing what a particular computed property returns, while keeping every other characteristic of the original object intact. The project is notably focused and minimal. It only copies "own" properties (things directly on the object, not inherited from a prototype), and it only does a shallow copy, meaning if a property holds another object, both the original and the clone point to the same nested object. This keeps things simple and predictable for cases where you need fine-grained control over property behavior rather than a deep duplication of data.
A small JavaScript utility that copies an object while preserving all hidden property rules, and optionally lets you override specific properties during the copy.
Mainly JavaScript. The stack also includes JavaScript.
Dormant — no commits in 2+ years (last push 2019-10-31).
No license information is provided in the repository, so usage rights are unclear.
Setup difficulty is rated easy, with roughly 5min to a first successful run.
Mainly developer.
This repo across BitVibe Labs
Don't trust strangers blindly. Verify against the repo.