2.1.4 • Published 6 months ago

@types/clone v2.1.4

Weekly downloads
231,183
License
MIT
Repository
github
Last release
6 months ago

Installation

npm install --save @types/clone

Summary

This package contains type definitions for clone (https://github.com/pvorb/node-clone).

Details

Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/clone.

index.d.ts

// Type definitions for clone 2.1
// Project: https://github.com/pvorb/node-clone
// Definitions by: Kieran Simpson <https://github.com/kierans>
//                 DG-za <https://github.com/DG-za>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped

/**
 * See clone JS source for API docs
 */

/**
 * @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 which the object is to be cloned (optional, defaults to infinity)
 * @param prototype Sets the prototype to be used when cloning an Object (optional, defaults to __proto__)
 * @param includeNonEnumerable Set to true if the non-enumerable properties should be cloned as well (optional, defaults to false)
 */
declare function clone<T>(val: T, circular?: boolean, depth?: number, prototype?: any, includeNonEnumerable?: boolean): T;

/**
 * @param val the value that you want to clone, any type allowed
 * @param opts a single object that specifies circular, depth, prototype and includeNonEnumerable.
 * @param opts.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 opts.depth Sets depth to which the object is to be cloned (optional, defaults to infinity)
 * @param opts.prototype Sets the prototype to be used when cloning an Object (optional, defaults to __proto__)
 * @param opts.includeNonEnumerable Set to true if the non-enumerable properties should be cloned as well (optional, defaults to false)
 */
declare function clone<T>(val: T, opts: CloneOpts): T;

interface CloneOpts {
    circular?: boolean | undefined,
    depth?: number | undefined,
    prototype?: any,
    includeNonEnumerable?: boolean | undefined
}

declare namespace clone {
    /**
     * @param obj the object that you want to clone
     */
    function clonePrototype<T>(obj: T): T;
}

export = clone

Additional Details

  • Last updated: Tue, 06 Jul 2021 18:05:53 GMT
  • Dependencies: none
  • Global values: none

Credits

These definitions were written by Kieran Simpson, and DG-za.

2.1.2

8 months ago

2.1.4

6 months ago

2.1.3

6 months ago

2.1.1

3 years ago

2.1.0

4 years ago

0.1.30

8 years ago

0.1.29

8 years ago

0.1.28-alpha

8 years ago

0.1.27-alpha

8 years ago

0.1.26-alpha

8 years ago

0.1.25-alpha

8 years ago

0.1.24-alpha

8 years ago

0.1.23-alpha

8 years ago

0.1.22-alpha

8 years ago

0.1.17-alpha

8 years ago

0.1.16-alpha

8 years ago