sasaplus1 / Deepcopy.js
Licence: mit
deep copy data
Stars: ✭ 112
Programming Languages
javascript
184084 projects - #8 most used programming language
typescript
32286 projects
Projects that are alternatives of or similar to Deepcopy.js
Swarmz
A free, header-only C++ swarming (flocking) library for real-time applications
Stars: ✭ 108 (-3.57%)
Mutual labels: library
Esp32 Mpu Driver
ESP32 full library for all MPU6000 MPU6050 MPU6500 MPU9150 MPU9250 with SPI and I2C support and more.
Stars: ✭ 111 (-0.89%)
Mutual labels: library
Maz Ui
Stand-alone components library to build your interfaces with Vue.JS & Nuxt.JS
Stars: ✭ 109 (-2.68%)
Mutual labels: library
Py7zr
7zip in python3 with ZStandard, PPMd, LZMA2, LZMA1, Delta, BCJ, BZip2, and Deflate compressions, and AES encryption.
Stars: ✭ 110 (-1.79%)
Mutual labels: library
Atlas.js
A component-based Node.js library to reduce boilerplate and provide sane project structure 🍻
Stars: ✭ 108 (-3.57%)
Mutual labels: library
Androidaudiorecorder
A fancy audio recorder lib for Android. Supports WAV format at 48kHz.
Stars: ✭ 1,524 (+1260.71%)
Mutual labels: library
Lift
constexpr C++17 library for simplifying higher order functions in application code
Stars: ✭ 111 (-0.89%)
Mutual labels: library
Xseries
Library for cross-version Minecraft Bukkit support and various efficient API methods.
Stars: ✭ 109 (-2.68%)
Mutual labels: library
Jtop
SVG virtual desktop library that lets you build beautiful desktop like user interfaces.
Stars: ✭ 108 (-3.57%)
Mutual labels: library
Inapppy
Python In-app purchase validator for Apple AppStore and GooglePlay.
Stars: ✭ 110 (-1.79%)
Mutual labels: library
Forcelayout
Forcelayout is library for android. You can drawing graph with spring-like attractive forces. Inspired by force layout in D3.js.
Stars: ✭ 108 (-3.57%)
Mutual labels: library
Libbrotli
meta project to build libraries from the brotli source code
Stars: ✭ 110 (-1.79%)
Mutual labels: library
Colibri Core
Colibri core is an NLP tool as well as a C++ and Python library for working with basic linguistic constructions such as n-grams and skipgrams (i.e patterns with one or more gaps, either of fixed or dynamic size) in a quick and memory-efficient way. At the core is the tool ``colibri-patternmodeller`` whi ch allows you to build, view, manipulate and query pattern models.
Stars: ✭ 112 (+0%)
Mutual labels: library
Battery.js
A tiny wrapper for the HTML5 Battery Status API.
Stars: ✭ 111 (-0.89%)
Mutual labels: library
Bokkypoobahsdatetimelibrary
Gas-Efficient Solidity DateTime Library
Stars: ✭ 111 (-0.89%)
Mutual labels: library
deepcopy.js
deep copy data
Installation
npm
$ npm install deepcopy
Usage
node.js
JavaScript
const deepcopy = require('deepcopy');
TypeScript
import * as deepcopy from 'deepcopy';
browser
<script src="deepcopy.min.js"></script>
Example
basic usage:
const src = {
desserts: [
{ name: 'cake' },
{ name: 'ice cream' },
{ name: 'pudding' }
]
};
const dist = deepcopy(src);
src.desserts = null;
console.log(src); // { desserts: null }
console.log(dist); // { desserts: [ { name: 'cake' }, { name: 'ice cream' }, { name: 'pudding' } ] }
customize deepcopy:
function MyClass(id) {
this._id = id;
}
const src = {
myClasses: [
new MyClass(1),
new MyClass(2),
new MyClass(3)
]
};
const dest = deepcopy(base, {
customizer(value) {
if (target.constructor === MyClass) {
return new MyClass(target._id);
}
}
});
src.myClasses = null;
console.log(src); // { myClasses: null }
console.log(dest); // { myClasses: [ MyClass { _id: 1 }, MyClass { _id: 2 }, MyClass { _id: 3 } ] }
Functions
deepcopy(value[, options])
-
value
-
*
- target value
-
-
options
-
Object|Function
-
Object
- pass options -
Function
- use as customize function
-
-
-
return
-
*
- copied value
-
Supported types and copy operation
type | operation | |
---|---|---|
ArrayBuffer | deep copy | |
Boolean | deep copy | |
Buffer | deep copy | node.js only |
DataView | deep copy | |
Date | deep copy | |
Number | deep copy | |
RegExp | deep copy | |
String | deep copy | |
Float32Array | deep copy | |
Float64Array | deep copy | |
Int16Array | deep copy | |
Int32Array | deep copy | |
Int8Array | deep copy | |
Uint16Array | deep copy | |
Uint32Array | deep copy | |
Uint8Array | deep copy | |
Uint8ClampedArray | deep copy | |
boolean | deep copy | |
null | deep copy | |
number | deep copy | |
string | deep copy | |
symbol | deep copy | |
undefined | deep copy | |
Arguments | deep copy | recursively, copy as Array |
Array | deep copy | recursively |
Map | deep copy | recursively |
Object | deep copy | recursively |
Set | deep copy | recursively |
Array Iterator | shallow copy | |
Map Iterator | shallow copy | |
Promise | shallow copy | |
Set Iterator | shallow copy | |
String Iterator | shallow copy | |
function | shallow copy | |
global | shallow copy | window, global, self, etc. |
WeakMap | shallow copy | |
WeakSet | shallow copy |
Contributors
License
The MIT license.
Note that the project description data, including the texts, logos, images, and/or trademarks,
for each open source project belongs to its rightful owner.
If you wish to add or remove any projects, please contact us at [email protected].