https://github.com/steveswork/clone-total
https://github.com/steveswork/clone-total
Last synced: 4 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/steveswork/clone-total
- Owner: steveswork
- License: mit
- Created: 2024-05-23T00:31:15.000Z (about 2 years ago)
- Default Branch: master
- Last Pushed: 2024-06-01T22:56:16.000Z (about 2 years ago)
- Last Synced: 2025-10-30T05:02:56.713Z (8 months ago)
- Language: JavaScript
- Size: 92.8 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# Clone Total
Regular clonedeep including all instances implementing the `clone` and the `cloneNode` methods.
This is an unscoped version of the [@webkrafters/clone-total](https://www.npmjs.com/package/@webkrafters/clone-total) package.
**Install:**\
npm i -S clone-total\
Alternate: npm i -S @webkrafters/clone-total
## Regarding Class Instances Values
All cloned properties and values which are Instances of non-native classes not implementing either the `clone` or the `cloneNode` methods may not be cloneable. Such instances are retured uncloned. To clone these, a `customizer` argument function may be supplied. Please see **Extended** example below.
### Example
```jsx
import clone from 'clone-total';
clone( object ); // returns cloned object
```
### Example (Extended)
```jsx
function customizer(
value : unknown,
key? : number | string,
object? : T,
stack? : unknown
) {
if( /* */ ) {
return yourCloneAlgorithm( value, key, object, stack );
}
// or allow the normal course to continue.
};
clone( object, customizer );
```
# License
MIT