mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-07-03 16:50:15 +00:00
Merge pull request #3153 from progre/feature/clone
clone: add the 3rd parameter and one function
This commit is contained in:
@@ -6,4 +6,5 @@ var original = {
|
||||
|
||||
var copy = clone(original);
|
||||
copy = clone(original, false);
|
||||
copy = clone(original, true);
|
||||
copy = clone(original, true, 1);
|
||||
copy = clone.clonePrototype(original);
|
||||
|
||||
14
clone/clone.d.ts
vendored
14
clone/clone.d.ts
vendored
@@ -8,10 +8,18 @@
|
||||
*/
|
||||
declare module "clone" {
|
||||
/**
|
||||
* @param parent
|
||||
* @param circular If not given, defaults to true in JS lib.
|
||||
* @param val the value that you want to clone, any type allowed
|
||||
* @param circular Call clone with circular set to false if you are certain that obj contains no circular references. This will give better performance if needed. There is no error if undefined or null is passed as obj.
|
||||
* @param depth to wich the object is to be cloned (optional, defaults to infinity)
|
||||
*/
|
||||
function clone(parent: Object, circular?: boolean): Object
|
||||
function clone<T>(val: T, circular?: boolean, depth?: number): T;
|
||||
|
||||
module clone {
|
||||
/**
|
||||
* @param obj the object that you want to clone
|
||||
*/
|
||||
function clonePrototype<T>(obj: T): T;
|
||||
}
|
||||
|
||||
export = clone
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user